//! Generated code! Take a look at the generator-crate for changing this file!
#![allow(clippy::too_many_lines, reason = "Generated code")]
use ::core::num::NonZeroU32;
use serde::{Serialize, Deserialize};
#[cfg(feature = "builders")]
use derive_builder::Builder;
use super::super::codes;
use super::super::types::*;
#[allow(unused_imports, reason = "Generated code; Integer64 is unused in R4B")]
use crate::{
    Base64Binary, Date, DateTime, Instant, Time, Integer64, error::WrongResourceType,
};
/** Base StructureDefinition for Account Resource

 **[Account](http://hl7.org/fhir/StructureDefinition/Account) v3.0.2**

 Tracks balance, charges, for patient or cost center

 A financial tool for tracking value accrued for a particular purpose.  In the healthcare field, used to track charges for a patient, cost centers, etc.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Account(pub Box<AccountInner>);
/** Base StructureDefinition for Account Resource

 **[Account](http://hl7.org/fhir/StructureDefinition/Account) v3.0.2**

 Tracks balance, charges, for patient or cost center

 A financial tool for tracking value accrued for a particular purpose.  In the healthcare field, used to track charges for a patient, cost centers, etc.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AccountBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct AccountInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Account::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Account", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Account number**

 Unique identifier used to reference the account.  May or may not be intended for human use (e.g. credit card number).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[AccountStatus](http://hl7.org/fhir/ValueSet/account-status); active | inactive | entered-in-error**

 Indicates whether the account is presently used/usable or not.

 This element is labeled as a modifier because the status contains the codes inactive and entered-in-error that mark the Account as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<codes::AccountStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[AccountType](http://hl7.org/fhir/ValueSet/account-type); E.g. patient, expense, depreciation**

 Categorizes the account for reporting and searching purposes.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Human-readable label**

 Name used for the account when displaying it to humans in reports, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **What is account tied to?**

 Identifies the patient, device, practitioner, location or other object the account is associated with.

 Accounts can be applied to non patients for tracking other non patient related activities, such as group services (patients not tracked, and costs charged to another body), or may not be allocated. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Transaction window**

 Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc.

 It is possible for transactions relevant to a coverage period to be posted to the account before or after the coverage period, however the services that are being charged for must be within this period. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
    /** **Time window that transactions may be posted to this account**

 Indicates the period of time over which the account is allowed to have transactions posted to it.
This period may be different to the coveragePeriod which is the duration of time that services may occur.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "active")]
    pub active: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_active")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub active_ext: Option<FieldExtension>,
    /** **How much is in account?**

 Represents the sum of all credits less all debits associated with the account.  Might be positive, zero or negative.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "balance")]
    pub balance: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_balance")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub balance_ext: Option<FieldExtension>,
    /** **The party(s) that are responsible for covering the payment of this account, and what order should they be applied to the account**

 The party(s) that are responsible for covering the payment of this account, and what order should they be applied to the account.

 Typically this may be some form of insurance, internal charges, or self-pay.

Local or jurisdicational business rules may determine which coverage covers which types of billable items charged to the account, and in which order.
Where the order is important, a local/jurisdicational extension may be defined to specify the order for the type of charge. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "coverage")]
    pub coverage: Vec<Option<AccountCoverage>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_coverage")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub coverage_ext: Vec<Option<FieldExtension>>,
    /** **Who is responsible?**

 Indicates the organization, department, etc. with responsibility for the account.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "owner")]
    pub owner: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_owner")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub owner_ext: Option<FieldExtension>,
    /** **Explanation of purpose/use**

 Provides additional information about what the account tracks and how it is used.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Responsible for the account**

 Parties financially responsible for the account.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "guarantor")]
    pub guarantor: Vec<Option<AccountGuarantor>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_guarantor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub guarantor_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl AccountBuilder {
    #[doc = concat!("Finalize building ", "Account", ".")]
    pub fn build(self) -> Result<Account, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<AccountInner> for Account {
    fn from(inner: AccountInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Account {
    type Target = AccountInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Account {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Account {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> AccountBuilder {
        AccountBuilder::default()
    }
}
impl Account {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Account
    }
}
/// Sub-fields of the coverage field in Account
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AccountCoverageBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AccountCoverage {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **The party(s) that are responsible for covering the payment of this account**

 The party(s) that are responsible for payment (or part of) of charges applied to this account (including self-pay).

A coverage may only be resposible for specific types of charges, and the sequence of the coverages in the account could be important when processing billing.

 */
    #[serde(rename = "coverage")]
    pub coverage: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_coverage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub coverage_ext: Option<FieldExtension>,
    /** **The priority of the coverage in the context of this account**

 The priority of the coverage in the context of this account.

 It is common in some jurisdictions for there to be multiple coverages allocated to an account, and a sequence is required to order the settling of the account (often with insurance claiming). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "priority")]
    pub priority: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_priority")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub priority_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl AccountCoverage {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AccountCoverageBuilder {
        AccountCoverageBuilder::default()
    }
}
/// Sub-fields of the guarantor field in Account
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AccountGuarantorBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AccountGuarantor {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Responsible entity**

 The entity who is responsible.

 */
    #[serde(rename = "party")]
    pub party: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_party")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub party_ext: Option<FieldExtension>,
    /** **Credit or other hold applied**

 A guarantor may be placed on credit hold or otherwise have their role temporarily suspended.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "onHold")]
    pub on_hold: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_onHold")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub on_hold_ext: Option<FieldExtension>,
    /** **Guarrantee account during**

 The timeframe during which the guarantor accepts responsibility for the account.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl AccountGuarantor {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AccountGuarantorBuilder {
        AccountGuarantorBuilder::default()
    }
}
/** Base StructureDefinition for ActivityDefinition Resource

 **[ActivityDefinition](http://hl7.org/fhir/StructureDefinition/ActivityDefinition) v3.0.2**

 The definition of a specific activity to be taken, independent of any particular patient or context

 This resource allows for the definition of some activity to be performed, independent of a particular patient, practitioner, or other performance context.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ActivityDefinition(pub Box<ActivityDefinitionInner>);
/** Base StructureDefinition for ActivityDefinition Resource

 **[ActivityDefinition](http://hl7.org/fhir/StructureDefinition/ActivityDefinition) v3.0.2**

 The definition of a specific activity to be taken, independent of any particular patient or context

 This resource allows for the definition of some activity to be performed, independent of a particular patient, practitioner, or other performance context.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ActivityDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ActivityDefinitionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ActivityDefinition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ActivityDefinition", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical URI to reference this activity definition (globally unique)**

 An absolute URI that is used to identify this activity definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this activity definition is (or will be) published. The URL SHOULD include the major version of the activity definition. For more information see [Technical and Business Versions](resource.html#versions).

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred.  Multiple instances may share the same url if they have a distinct version. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "url")]
    pub url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Additional identifier for the activity definition**

 A formal identifier that is used to identify this activity definition when it is represented in other formats, or referenced in a specification, model, design or an instance.

 Typically, this is used for identifiers that can go in an HL7 V3 II (instance identifier) data type, e.g., to identify this activity definition outside of FHIR, where it is not possible to use the logical URI. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Business version of the activity definition**

 The identifier that is used to identify this version of the activity definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the activity definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge assets, refer to the Decision Support Service specification. Note that a version is required for non-experimental active assets.

 There may be different activity definition instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a refrence to a particular business version of the activity definition with the format [url]|[version]. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Name for this activity definition (computer friendly)**

 A natural language name identifying the activity definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.

 The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure that it is computable friendly. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Name for this activity definition (human friendly)**

 A short, descriptive, user-friendly title for the activity definition.

 This name does not need to be machine-processing friendly and may contain punctuation, white-space, etc. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this activity definition. Enables tracking the life-cycle of the content.

 Allows filtering of activity definitions that are appropriate for use vs. not.
This is labeled as "Is Modifier" because applications should not use a retired activity definition without due consideration. */
    #[serde(rename = "status")]
    pub status: codes::PublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **For testing purposes, not real usage**

 A boolean value to indicate that this activity definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of activity definition that are appropriate for use vs. not. This is labeled as "Is Modifier" because applications should not use an experimental activity definition in production. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "experimental")]
    pub experimental: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_experimental")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub experimental_ext: Option<FieldExtension>,
    /** **Date this was last changed**

 The date  (and optionally time) when the activity definition was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the activity definition changes.

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the activity definition. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Name of the publisher (organization or individual)**

 The name of the individual or organization that published the activity definition.

 Usually an organization, but may be an individual. The publisher (or steward) of the activity definition is the organization or individual primarily responsible for the maintenance and upkeep of the activity definition. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the activity definition. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisher")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_ext: Option<FieldExtension>,
    /** **Natural language description of the activity definition**

 A free text natural language description of the activity definition from a consumer's perspective.

 This description can be used to capture details such as why the activity definition was built, comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the activity definition as conveyed in the 'text' field of the resource itself. This item SHOULD be populated unless the information is available from context (e.g. the language of the profile is presumed to be the predominant language in the place the profile was created). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Why this activity definition is defined**

 Explaination of why this activity definition is needed and why it has been designed as it has.

 This element does not describe the usage of the activity definition Instead  it provides traceability of ''why'' the resource is either needed or ''why'' it is defined as it is.  This may be used to point to source materials or specifications that drove the structure of this activity definition. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purpose")]
    pub purpose: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_purpose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub purpose_ext: Option<FieldExtension>,
    /** **Describes the clinical usage of the asset**

 A detailed description of how the asset is used from a clinical perspective.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "usage")]
    pub usage: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_usage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub usage_ext: Option<FieldExtension>,
    /** **When the activity definition was approved by publisher**

 The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.

 The 'date' element may be more recent than the approval date because of minor changes / editorial corrections. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "approvalDate")]
    pub approval_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_approvalDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub approval_date_ext: Option<FieldExtension>,
    /** **When the activity definition was last reviewed**

 The date on which the resource content was last reviewed. Review happens periodically after approval, but doesn't change the original approval date.

 If specified, this is usually after the approval date. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "lastReviewDate")]
    pub last_review_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_lastReviewDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub last_review_date_ext: Option<FieldExtension>,
    /** **When the activity definition is expected to be used**

 The period during which the activity definition content was or is planned to be in active use.

 The effective period for a activity definition  determines when the content is applicable for usage and is independent of publication and review dates. For example, a measure intended to be used for the year 2016 might be published in 2015. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "effectivePeriod")]
    pub effective_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_effectivePeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub effective_period_ext: Option<FieldExtension>,
    /** **Context the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate activity definition instances.

 When multiple useContexts are specified, there is no expectation whether all or any of the contexts apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useContext")]
    pub use_context: Vec<Option<UsageContext>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_useContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_context_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Intended jurisdiction for activity definition (if applicable)**

 A legal or geographic region in which the activity definition is intended to be used.

 It may be possible for the activity definition to be used in jurisdictions other than those for which it was originally designed or intended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **[DefinitionTopic](http://hl7.org/fhir/ValueSet/definition-topic); E.g. Education, Treatment, Assessment, etc**

 Descriptive topics related to the content of the activity. Topics provide a high-level categorization of the activity that can be useful for filtering and searching.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "topic")]
    pub topic: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_topic")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub topic_ext: Vec<Option<FieldExtension>>,
    /** **A content contributor**

 A contributor to the content of the asset, including authors, editors, reviewers, and endorsers.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contributor")]
    pub contributor: Vec<Option<Contributor>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contributor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contributor_ext: Vec<Option<FieldExtension>>,
    /** **Contact details for the publisher**

 Contact details to assist a user in finding and communicating with the publisher.

 May be a web site, an email address, a telephone number, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Use and/or publishing restrictions**

 A copyright statement relating to the activity definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the activity definition.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyright")]
    pub copyright: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyright")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_ext: Option<FieldExtension>,
    /** **Additional documentation, citations, etc**

 Related artifacts such as additional documentation, justification, or bibliographic references.

 Each related artifact is either an attachment, or a reference to another resource, but not both. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relatedArtifact")]
    pub related_artifact: Vec<Option<RelatedArtifact>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_relatedArtifact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub related_artifact_ext: Vec<Option<FieldExtension>>,
    /** **Logic used by the asset**

 A reference to a Library resource containing any formal logic used by the asset.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "library")]
    pub library: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_library")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub library_ext: Vec<Option<FieldExtension>>,
    /** **[ActivityDefinitionKind](http://hl7.org/fhir/ValueSet/resource-types); Kind of resource**

 A description of the kind of resource the activity definition is representing. For example, a MedicationRequest, a ProcedureRequest, or a CommunicationRequest. Typically, but not always, this is a Request resource.

 May determine what types of extensions are permitted. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "kind")]
    pub kind: Option<codes::ResourceType>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_kind")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub kind_ext: Option<FieldExtension>,
    /** **[ActivityDefinitionType](http://hl7.org/fhir/ValueSet/procedure-code); Detail type of activity**

 Detailed description of the type of activity; e.g. What lab test, what procedure, what kind of encounter.

 Tends to be less relevant for activities involving particular products. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **When activity is to occur**

 The period, timing or frequency upon which the described activity is to occur.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub timing: Option<ActivityDefinitionTiming>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub timing_ext: Option<ActivityDefinitionTimingExtension>,
    /** **Where it should happen**

 Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc.

 May reference a specific clinical location or may just identify a type of location. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "location")]
    pub location: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_location")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub location_ext: Option<FieldExtension>,
    /** **Who should participate in the action**

 Indicates who should participate in performing the action described.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "participant")]
    pub participant: Vec<Option<ActivityDefinitionParticipant>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_participant")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub participant_ext: Vec<Option<FieldExtension>>,
    /** **What's administered/supplied**

 Identifies the food, drug or other product being consumed or supplied in the activity.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub product: Option<ActivityDefinitionProduct>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_ext: Option<ActivityDefinitionProductExtension>,
    /** **How much is administered/consumed/supplied**

 Identifies the quantity expected to be consumed at once (per dose, per meal, etc.).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_quantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<FieldExtension>,
    /** **Detailed dosage instructions**

 Provides detailed dosage instructions in the same way that they are described for MedicationRequest resources.

 If a dosage instruction is used, the definition should not specify timing or quantity. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dosage")]
    pub dosage: Vec<Option<Dosage>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_dosage")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub dosage_ext: Vec<Option<FieldExtension>>,
    /** **[BodySite](http://hl7.org/fhir/ValueSet/body-site); What part of body to perform on**

 Indicates the sites on the subject's body where the procedure should be performed (I.e. the target sites).

 Only used if not implicit in the code found in ProcedureRequest.type. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "bodySite")]
    pub body_site: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_bodySite")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub body_site_ext: Vec<Option<FieldExtension>>,
    /** **Transform to apply the template**

 A reference to a StructureMap resource that defines a transform that can be executed to produce the intent resource using the ActivityDefinition instance as the input.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "transform")]
    pub transform: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_transform")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub transform_ext: Option<FieldExtension>,
    /** **Dynamic aspects of the definition**

 Dynamic values that will be evaluated to produce values for elements of the resulting resource. For example, if the dosage of a medication must be computed based on the patient's weight, a dynamic value would be used to specify an expression that calculated the weight, and the path on the intent resource that would contain the result.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dynamicValue")]
    pub dynamic_value: Vec<Option<ActivityDefinitionDynamicValue>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_dynamicValue")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub dynamic_value_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ActivityDefinitionBuilder {
    #[doc = concat!("Finalize building ", "ActivityDefinition", ".")]
    pub fn build(self) -> Result<ActivityDefinition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ActivityDefinitionInner> for ActivityDefinition {
    fn from(inner: ActivityDefinitionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ActivityDefinition {
    type Target = ActivityDefinitionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ActivityDefinition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ActivityDefinition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ActivityDefinitionBuilder {
        ActivityDefinitionBuilder::default()
    }
}
impl ActivityDefinition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ActivityDefinition
    }
}
/// Choice of types for the timing[x] field in ActivityDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ActivityDefinitionTiming {
    /// Variant accepting the Timing type.
    #[serde(rename = "timingTiming")]
    Timing(Timing),
    /// Variant accepting the DateTime type.
    #[serde(rename = "timingDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "timingPeriod")]
    Period(Period),
    /// Variant accepting the Range type.
    #[serde(rename = "timingRange")]
    Range(Range),
}
/// Extension value for ActivityDefinitionTiming.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ActivityDefinitionTimingExtension {
    /// Variant accepting the Timing extension.
    #[serde(rename = "_timingTiming")]
    Timing(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_timingDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_timingPeriod")]
    Period(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_timingRange")]
    Range(FieldExtension),
}
/// Sub-fields of the participant field in ActivityDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ActivityDefinitionParticipantBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ActivityDefinitionParticipant {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ActivityParticipantType](http://hl7.org/fhir/ValueSet/action-participant-type); patient | practitioner | related-person**

 The type of participant in the action.

 */
    #[serde(rename = "type")]
    pub r#type: codes::ActionParticipantType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[ActivityParticipantRole](http://hl7.org/fhir/ValueSet/action-participant-role); E.g. Nurse, Surgeon, Parent, etc**

 The role the participant should play in performing the described action.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "role")]
    pub role: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_role")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub role_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ActivityDefinitionParticipant {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ActivityDefinitionParticipantBuilder {
        ActivityDefinitionParticipantBuilder::default()
    }
}
/// Choice of types for the product[x] field in ActivityDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ActivityDefinitionProduct {
    /// Variant accepting the Reference type.
    #[serde(rename = "productReference")]
    Reference(Reference),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "productCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for ActivityDefinitionProduct.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ActivityDefinitionProductExtension {
    /// Variant accepting the Reference extension.
    #[serde(rename = "_productReference")]
    Reference(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_productCodeableConcept")]
    CodeableConcept(FieldExtension),
}
/// Sub-fields of the dynamicValue field in ActivityDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ActivityDefinitionDynamicValueBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ActivityDefinitionDynamicValue {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Natural language description of the dynamic value**

 A brief, natural language description of the intended semantics of the dynamic value.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **The path to the element to be set dynamically**

 The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "path")]
    pub path: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_path")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub path_ext: Option<FieldExtension>,
    /** **Language of the expression**

 The media type of the language for the expression.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_language")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub language_ext: Option<FieldExtension>,
    /** **An expression that provides the dynamic value for the customization**

 An expression specifying the value of the customized element.

 The expression may be inlined, or may be a reference to a named expression within a logic library referenced by the library element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "expression")]
    pub expression: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_expression")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub expression_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ActivityDefinitionDynamicValue {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ActivityDefinitionDynamicValueBuilder {
        ActivityDefinitionDynamicValueBuilder::default()
    }
}
/** Base StructureDefinition for AdverseEvent Resource

 **[AdverseEvent](http://hl7.org/fhir/StructureDefinition/AdverseEvent) v3.0.2**

 Medical care, research study or other healthcare event causing physical injury

 Actual or  potential/avoided event causing unintended physical injury resulting from or contributed to by medical care, a research study or other healthcare setting factors that requires additional monitoring, treatment, or hospitalization, or that results in death.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct AdverseEvent(pub Box<AdverseEventInner>);
/** Base StructureDefinition for AdverseEvent Resource

 **[AdverseEvent](http://hl7.org/fhir/StructureDefinition/AdverseEvent) v3.0.2**

 Medical care, research study or other healthcare event causing physical injury

 Actual or  potential/avoided event causing unintended physical injury resulting from or contributed to by medical care, a research study or other healthcare setting factors that requires additional monitoring, treatment, or hospitalization, or that results in death.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AdverseEventBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct AdverseEventInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "AdverseEvent::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::AdverseEvent", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business identifier for the event**

 The identifier(s) of this adverse event that are assigned by business processes and/or used to refer to it when a direct URL reference to the resource itsefl is not appropriate.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **[AdverseEventCategory](http://hl7.org/fhir/ValueSet/adverse-event-category); AE | PAE
An adverse event is an event that caused harm to a patient,  an adverse reaction is a something that is a subject-specific event that is a result of an exposure to a medication, food, device or environmental substance, a potential adverse event is something that occurred and that could have caused harm to a patient but did not**

 The type of event which is important to characterize what occurred and caused harm to the subject, or had the potential to cause harm to the subject.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<codes::AdverseEventCategory>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[AdverseEventType](http://hl7.org/fhir/ValueSet/adverse-event-type); actual | potential**

 This element defines the specific type of event that occurred or that was prevented from occurring.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Subject or group impacted by event**

 This subject or group impacted by the event.  With a prospective adverse event, there will be no subject as the adverse event was prevented.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **When the event occurred**

 The date (and perhaps time) when the adverse event occurred.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Adverse Reaction Events linked to exposure to substance**

 Includes information about the reaction that occurred as a result of exposure to a substance (for example, a drug or a chemical).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reaction")]
    pub reaction: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reaction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reaction_ext: Vec<Option<FieldExtension>>,
    /** **Location where adverse event occurred**

 The information about where the adverse event occurred.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "location")]
    pub location: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_location")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub location_ext: Option<FieldExtension>,
    /** **[AdverseEventSeriousness](http://hl7.org/fhir/ValueSet/adverse-event-seriousness); Mild | Moderate | Severe**

 Describes the seriousness or severity of the adverse event.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "seriousness")]
    pub seriousness: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_seriousness")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub seriousness_ext: Option<FieldExtension>,
    /** **[AdverseEventOutcome](http://hl7.org/fhir/ValueSet/adverse-event-outcome); resolved | recovering | ongoing | resolvedWithSequelae | fatal | unknown**

 Describes the type of outcome from the adverse event.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "outcome")]
    pub outcome: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_outcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub outcome_ext: Option<FieldExtension>,
    /** **Who recorded the adverse event**

 Information on who recorded the adverse event.  May be the patient or a practitioner.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recorder")]
    pub recorder: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_recorder")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub recorder_ext: Option<FieldExtension>,
    /** **Who  was involved in the adverse event or the potential adverse event**

 Parties that may or should contribute or have contributed information to the Act. Such information includes information leading to the decision to perform the Act and how to perform the Act (e.g. consultant), information that the Act itself seeks to reveal (e.g. informant of clinical history), or information about what Act was performed (e.g. informant witness).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "eventParticipant")]
    pub event_participant: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_eventParticipant")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub event_participant_ext: Option<FieldExtension>,
    /** **Description of the adverse event**

 Describes the adverse event in text.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **The suspected agent causing the adverse event**

 Describes the entity that is suspected to have caused the adverse event.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "suspectEntity")]
    pub suspect_entity: Vec<Option<AdverseEventSuspectEntity>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_suspectEntity")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub suspect_entity_ext: Vec<Option<FieldExtension>>,
    /** **AdverseEvent.subjectMedicalHistory**

 AdverseEvent.subjectMedicalHistory.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subjectMedicalHistory")]
    pub subject_medical_history: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subjectMedicalHistory")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub subject_medical_history_ext: Vec<Option<FieldExtension>>,
    /** **AdverseEvent.referenceDocument**

 AdverseEvent.referenceDocument.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "referenceDocument")]
    pub reference_document: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_referenceDocument")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reference_document_ext: Vec<Option<FieldExtension>>,
    /** **AdverseEvent.study**

 AdverseEvent.study.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "study")]
    pub study: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_study")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub study_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl AdverseEventBuilder {
    #[doc = concat!("Finalize building ", "AdverseEvent", ".")]
    pub fn build(self) -> Result<AdverseEvent, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<AdverseEventInner> for AdverseEvent {
    fn from(inner: AdverseEventInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for AdverseEvent {
    type Target = AdverseEventInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for AdverseEvent {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl AdverseEvent {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> AdverseEventBuilder {
        AdverseEventBuilder::default()
    }
}
impl AdverseEvent {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::AdverseEvent
    }
}
/// Sub-fields of the suspectEntity field in AdverseEvent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AdverseEventSuspectEntityBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AdverseEventSuspectEntity {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Refers to the specific entity that caused the adverse event**

 Identifies the actual instance of what caused the adverse event.  May be a substance, medication, medication administration, medication statement or a device.

 */
    #[serde(rename = "instance")]
    pub instance: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_instance")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub instance_ext: Option<FieldExtension>,
    /** **[AdverseEventCausality](http://hl7.org/fhir/ValueSet/adverse-event-causality); causality1 | causality2**

 causality1 | causality2.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "causality")]
    pub causality: Option<codes::AdverseEventCausality>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_causality")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub causality_ext: Option<FieldExtension>,
    /** **[AdverseEventCausalityAssessment](http://hl7.org/fhir/ValueSet/adverse-event-causality-assess); assess1 | assess2**

 assess1 | assess2.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "causalityAssessment")]
    pub causality_assessment: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_causalityAssessment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub causality_assessment_ext: Option<FieldExtension>,
    /** **AdverseEvent.suspectEntity.causalityProductRelatedness**

 AdverseEvent.suspectEntity.causalityProductRelatedness.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "causalityProductRelatedness")]
    pub causality_product_relatedness: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_causalityProductRelatedness")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub causality_product_relatedness_ext: Option<FieldExtension>,
    /** **[AdverseEventCausalityMethod](http://hl7.org/fhir/ValueSet/adverse-event-causality-method); method1 | method2**

 method1 | method2.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "causalityMethod")]
    pub causality_method: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_causalityMethod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub causality_method_ext: Option<FieldExtension>,
    /** **AdverseEvent.suspectEntity.causalityAuthor**

 AdverseEvent.suspectEntity.causalityAuthor.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "causalityAuthor")]
    pub causality_author: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_causalityAuthor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub causality_author_ext: Option<FieldExtension>,
    /** **[AdverseEventCausalityResult](http://hl7.org/fhir/ValueSet/adverse-event-causality-result); result1 | result2**

 result1 | result2.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "causalityResult")]
    pub causality_result: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_causalityResult")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub causality_result_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl AdverseEventSuspectEntity {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AdverseEventSuspectEntityBuilder {
        AdverseEventSuspectEntityBuilder::default()
    }
}
/** Base StructureDefinition for AllergyIntolerance Resource

 **[AllergyIntolerance](http://hl7.org/fhir/StructureDefinition/AllergyIntolerance) v3.0.2**

 Allergy or Intolerance (generally: Risk of adverse reaction to a substance)

 Risk of harmful or undesirable, physiological response which is unique to an individual and associated with exposure to a substance.

 Substances include, but are not limited to: a therapeutic substance administered correctly at an appropriate dosage for the individual; food; material derived from plants or animals; or venom from insect stings. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct AllergyIntolerance(pub Box<AllergyIntoleranceInner>);
/** Base StructureDefinition for AllergyIntolerance Resource

 **[AllergyIntolerance](http://hl7.org/fhir/StructureDefinition/AllergyIntolerance) v3.0.2**

 Allergy or Intolerance (generally: Risk of adverse reaction to a substance)

 Risk of harmful or undesirable, physiological response which is unique to an individual and associated with exposure to a substance.

 Substances include, but are not limited to: a therapeutic substance administered correctly at an appropriate dosage for the individual; food; material derived from plants or animals; or venom from insect stings. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AllergyIntoleranceBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct AllergyIntoleranceInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "AllergyIntolerance::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::AllergyIntolerance", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **External ids for this item**

 This records identifiers associated with this allergy/intolerance concern that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[AllergyIntoleranceClinicalStatus](http://hl7.org/fhir/ValueSet/allergy-clinical-status); active | inactive | resolved**

 The clinical status of the allergy or intolerance.

 This element is labeled as a modifier because the status contains the codes inactive and resolved that mark the AllergyIntolerance as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "clinicalStatus")]
    pub clinical_status: Option<codes::AllergyIntoleranceClinicalStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_clinicalStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub clinical_status_ext: Option<FieldExtension>,
    /** **[AllergyIntoleranceVerificationStatus](http://hl7.org/fhir/ValueSet/allergy-verification-status); unconfirmed | confirmed | refuted | entered-in-error**

 Assertion about certainty associated with the propensity, or potential risk, of a reaction to the identified substance (including pharmaceutical product).

 This element is labeled as a modifier because the status contains the codes refuted and entered-in-error that mark the AllergyIntolerance as not currently valid. */
    #[serde(rename = "verificationStatus")]
    pub verification_status: codes::AllergyIntoleranceVerificationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_verificationStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub verification_status_ext: Option<FieldExtension>,
    /** **[AllergyIntoleranceType](http://hl7.org/fhir/ValueSet/allergy-intolerance-type); allergy | intolerance - Underlying mechanism (if known)**

 Identification of the underlying physiological mechanism for the reaction risk.

 Allergic (typically immune-mediated) reactions have been traditionally regarded as an indicator for potential escalation to significant future risk. Contemporary knowledge suggests that some reactions previously thought to be immune-mediated are, in fact, non-immune, but in some cases can still pose a life threatening risk. It is acknowledged that many clinicians may not be in a position to distinguish the mechanism of a particular reaction. Often the term "allergy" is used rather generically and may overlap with the use of "intolerance" - in practice the boundaries between these two concepts may not be well-defined or understood. This data element is included nevertheless, because many legacy systems have captured this attribute. Immunologic testing may provide supporting evidence for the basis of the reaction and the causative substance, but no tests are 100% sensitive or specific for sensitivity to a particular substance. If, as is commonly the case, it is unclear whether the reaction is due to an allergy or an intolerance, then the type element should be omitted from the resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<codes::AllergyIntoleranceType>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[AllergyIntoleranceCategory](http://hl7.org/fhir/ValueSet/allergy-intolerance-category); food | medication | environment | biologic**

 Category of the identified substance.

 This data element has been included because it is currently being captured in some clinical systems. This data can be derived from the substance where coding systems are used, and is effectively redundant in that situation.  When searching on category, consider the implications of AllergyIntolerance resources without a category.  For example, when searching on category = medication, medication allergies that don't have a category valued will not be returned.  Refer to [search](search.html) for more information on how to search category with a :missing modifier to get allergies that don't have a category.  Additionally, category should be used with caution because category can be subjective based on the sender. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Vec<Option<codes::AllergyIntoleranceCategory>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub category_ext: Vec<Option<FieldExtension>>,
    /** **[AllergyIntoleranceCriticality](http://hl7.org/fhir/ValueSet/allergy-intolerance-criticality); low | high | unable-to-assess**

 Estimate of the potential clinical harm, or seriousness, of the reaction to the identified substance.

 The default criticality value for any propensity to an adverse reaction should be 'Low Risk', indicating at the very least a relative contraindication to deliberate or voluntary exposure to the substance. 'High Risk' is flagged if the clinician has identified a propensity for a more serious or potentially life-threatening reaction, such as anaphylaxis, and implies an absolute contraindication to deliberate or voluntary exposure to the substance. If this element is missing, the criticality is unknown (though it may be known elsewhere).

Systems that capture a severity at the condition level are actually representing the concept of criticality whereas the severity documented at the reaction level is representing the true reaction severity.  Existing systems that are capturing both condition criticality and reaction severity may use the term "severity" to represent both.  Criticality is the worst it could be in the future (i.e. situation-agnostic) whereas severity is situation-dependent. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "criticality")]
    pub criticality: Option<codes::AllergyIntoleranceCriticality>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_criticality")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub criticality_ext: Option<FieldExtension>,
    /** **[AllergyIntoleranceCode](http://hl7.org/fhir/ValueSet/allergyintolerance-code); Code that identifies the allergy or intolerance**

 Code for an allergy or intolerance statement (either a positive or a negated/excluded statement).  This may be a code for a substance or pharmaceutical product that is considered to be responsible for the adverse reaction risk (e.g., "Latex"), an allergy or intolerance condition (e.g., "Latex allergy"), or a negated/excluded code for a specific substance or class (e.g., "No latex allergy") or a general or categorical negated statement (e.g.,  "No known allergy", "No known drug allergies").

 It is strongly recommended that this element be populated using a terminology, where possible. For example, some terminologies used include RxNorm, SNOMED CT, DM+D, NDFRT, ICD-9, IDC-10, UNI, ATC and CPT. Plain text should only be used if there is no appropriate terminology available. Additional details can be specified in the text.

When a substance or product code is specified for the 'code' element, the "default" semantic context is that this is a positive statement of an allergy or intolerance (depending on the value of the 'type' element, if present) condition to the specified substance/product.  In the corresponding SNOMED CT allergy model, the specified substance/product is the target (destination) of the "Causative agent" relationship.

The 'substanceExposureRisk' extension is available as a structured and more flexible alternative to the 'code' element for making positive or negative allergy or intolerance statements.  This extension provides the capability to make "no known allergy" (or "no risk of adverse reaction") statements regarding any coded substance/product (including cases when a pre-coordinated "no allergy to x" concept for that substance/product does not exist).  If the 'substanceExposureRisk' extension is present, the AllergyIntolerance.code element SHALL be omitted. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Who the sensitivity is for**

 The patient who has the allergy or intolerance.

 */
    #[serde(rename = "patient")]
    pub patient: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_ext: Option<FieldExtension>,
    /** **When allergy or intolerance was identified**

 Estimated or actual date,  date-time, or age when allergy or intolerance was identified.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub onset: Option<AllergyIntoleranceOnset>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub onset_ext: Option<AllergyIntoleranceOnsetExtension>,
    /** **Date record was believed accurate**

 The date on which the existance of the AllergyIntolerance was first asserted or acknowledged.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "assertedDate")]
    pub asserted_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_assertedDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub asserted_date_ext: Option<FieldExtension>,
    /** **Who recorded the sensitivity**

 Individual who recorded the record and takes responsibility for its content.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recorder")]
    pub recorder: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_recorder")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub recorder_ext: Option<FieldExtension>,
    /** **Source of the information about the allergy**

 The source of the information about the allergy that is recorded.

 The recorder takes repsonsibility for the content, but can reference the source from where they got it. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "asserter")]
    pub asserter: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_asserter")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub asserter_ext: Option<FieldExtension>,
    /** **Date(/time) of last known occurrence of a reaction**

 Represents the date and/or time of the last known occurrence of a reaction event.

 This date may be replicated by one of the Onset of Reaction dates. Where a textual representation of the date of last occurrence is required e.g. 'In Childhood, '10 years ago' the Comment element should be used. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "lastOccurrence")]
    pub last_occurrence: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_lastOccurrence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub last_occurrence_ext: Option<FieldExtension>,
    /** **Additional text not captured in other fields**

 Additional narrative about the propensity for the Adverse Reaction, not captured in other fields.

 For example: including reason for flagging a seriousness of 'High Risk'; and instructions related to future exposure or administration of the substance, such as administration within an Intensive Care Unit or under corticosteroid cover. The notes should be related to an allergy or intolerance as a condition in general and not related to any particular episode of it. For episode notes and descriptions, use AllergyIntolerance.event.description and  AllergyIntolerance.event.notes. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
    /** **Adverse Reaction Events linked to exposure to substance**

 Details about each adverse reaction event linked to exposure to the identified substance.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reaction")]
    pub reaction: Vec<Option<AllergyIntoleranceReaction>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reaction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reaction_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl AllergyIntoleranceBuilder {
    #[doc = concat!("Finalize building ", "AllergyIntolerance", ".")]
    pub fn build(self) -> Result<AllergyIntolerance, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<AllergyIntoleranceInner> for AllergyIntolerance {
    fn from(inner: AllergyIntoleranceInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for AllergyIntolerance {
    type Target = AllergyIntoleranceInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for AllergyIntolerance {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl AllergyIntolerance {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> AllergyIntoleranceBuilder {
        AllergyIntoleranceBuilder::default()
    }
}
impl AllergyIntolerance {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::AllergyIntolerance
    }
}
/// Choice of types for the onset[x] field in AllergyIntolerance
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum AllergyIntoleranceOnset {
    /// Variant accepting the DateTime type.
    #[serde(rename = "onsetDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Age type.
    #[serde(rename = "onsetAge")]
    Age(Age),
    /// Variant accepting the Period type.
    #[serde(rename = "onsetPeriod")]
    Period(Period),
    /// Variant accepting the Range type.
    #[serde(rename = "onsetRange")]
    Range(Range),
    /// Variant accepting the String type.
    #[serde(rename = "onsetString")]
    String(String),
}
/// Extension value for AllergyIntoleranceOnset.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum AllergyIntoleranceOnsetExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_onsetDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Age extension.
    #[serde(rename = "_onsetAge")]
    Age(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_onsetPeriod")]
    Period(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_onsetRange")]
    Range(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_onsetString")]
    String(FieldExtension),
}
/// Sub-fields of the reaction field in AllergyIntolerance
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AllergyIntoleranceReactionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AllergyIntoleranceReaction {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[SubstanceCode](http://hl7.org/fhir/ValueSet/substance-code); Specific substance or pharmaceutical product considered to be responsible for event**

 Identification of the specific substance (or pharmaceutical product) considered to be responsible for the Adverse Reaction event. Note: the substance for a specific reaction may be different from the substance identified as the cause of the risk, but it must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite product that includes the identified substance. It must be clinically safe to only process the 'code' and ignore the 'reaction.substance'.

 Coding of the specific substance (or pharmaceutical product) with a terminology capable of triggering decision support should be used wherever possible.  The 'code' element allows for the use of a specific substance or pharmaceutical product, or a group or class of substances. In the case of an allergy or intolerance to a class of substances, (for example, "penicillins"), the 'reaction.substance' element could be used to code the specific substance that was identifed as having caused the reaction (for example, "amoxycillin"). Duplication of the value in the 'code' and 'reaction.substance' elements is acceptable when a specific substance has been recorded in 'code'. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "substance")]
    pub substance: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_substance")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub substance_ext: Option<FieldExtension>,
    /** **[Manifestation](http://hl7.org/fhir/ValueSet/clinical-findings); Clinical symptoms/signs associated with the Event**

 Clinical symptoms and/or signs that are observed or associated with the adverse reaction event.

 Manifestation can be expressed as a single word, phrase or brief description. For example: nausea, rash or no reaction. It is preferable that manifestation should be coded with a terminology, where possible. The values entered here may be used to display on an application screen as part of a list of adverse reactions, as recommended in the UK NHS CUI guidelines.  Terminologies commonly used include, but are not limited to, SNOMED CT or ICD10. */
    #[serde(rename = "manifestation")]
    pub manifestation: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_manifestation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub manifestation_ext: Vec<Option<FieldExtension>>,
    /** **Description of the event as a whole**

 Text description about the reaction as a whole, including details of the manifestation if required.

 Use the description to provide any details of a particular event of the occurred reaction such as circumstances, reaction specifics, what happened before/after. Information, related to the event, but not describing a particular care should be captured in the comment field. For example: at the age of four, the patient was given penicillin for strep throat and subsequently developed severe hives. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Date(/time) when manifestations showed**

 Record of the date and/or time of the onset of the Reaction.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "onset")]
    pub onset: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_onset")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub onset_ext: Option<FieldExtension>,
    /** **[AllergyIntoleranceSeverity](http://hl7.org/fhir/ValueSet/reaction-event-severity); mild | moderate | severe (of event as a whole)**

 Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations.

 It is acknowledged that this assessment is very subjective. There may be some some specific practice domains where objective scales have been applied. Objective scales can be included in this model as extensions. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "severity")]
    pub severity: Option<codes::AllergyIntoleranceSeverity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_severity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub severity_ext: Option<FieldExtension>,
    /** **[RouteOfAdministration](http://hl7.org/fhir/ValueSet/route-codes); How the subject was exposed to the substance**

 Identification of the route by which the subject was exposed to the substance.

 Coding of the route of exposure with a terminology should be used wherever possible. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "exposureRoute")]
    pub exposure_route: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_exposureRoute")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub exposure_route_ext: Option<FieldExtension>,
    /** **Text about event not captured in other fields**

 Additional text about the adverse reaction event not captured in other fields.

 Use this field to record information indirectly related to a particular event and not captured in the description. For example: Clinical records are no longer available, recorded based on information provided to the patient by her mother and her mother is deceased. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl AllergyIntoleranceReaction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AllergyIntoleranceReactionBuilder {
        AllergyIntoleranceReactionBuilder::default()
    }
}
/** Base StructureDefinition for Appointment Resource

 **[Appointment](http://hl7.org/fhir/StructureDefinition/Appointment) v3.0.2**

 A booking of a healthcare event among patient(s), practitioner(s), related person(s) and/or device(s) for a specific date/time. This may result in one or more Encounter(s)

 A booking of a healthcare event among patient(s), practitioner(s), related person(s) and/or device(s) for a specific date/time. This may result in one or more Encounter(s).

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Appointment(pub Box<AppointmentInner>);
/** Base StructureDefinition for Appointment Resource

 **[Appointment](http://hl7.org/fhir/StructureDefinition/Appointment) v3.0.2**

 A booking of a healthcare event among patient(s), practitioner(s), related person(s) and/or device(s) for a specific date/time. This may result in one or more Encounter(s)

 A booking of a healthcare event among patient(s), practitioner(s), related person(s) and/or device(s) for a specific date/time. This may result in one or more Encounter(s).

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AppointmentBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct AppointmentInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Appointment::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Appointment", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **External Ids for this item**

 This records identifiers associated with this appointment concern that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[AppointmentStatus](http://hl7.org/fhir/ValueSet/appointmentstatus); proposed | pending | booked | arrived | fulfilled | cancelled | noshow | entered-in-error**

 The overall status of the Appointment. Each of the participants has their own participation status which indicates their involvement in the process, however this status indicates the shared status.

 If the Appointment's status is "cancelled" then all participants are expected to have their calendars released for the appointment period, and as such any Slots that were marked as BUSY can be re-set to FREE.

This element is labeled as a modifier because the status contains the code entered-in-error that mark the Appointment as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::AppointmentStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[service-category](http://hl7.org/fhir/ValueSet/service-category); A broad categorisation of the service that is to be performed during this appointment**

 A broad categorisation of the service that is to be performed during this appointment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "serviceCategory")]
    pub service_category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_serviceCategory")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub service_category_ext: Option<FieldExtension>,
    /** **[service-type](http://hl7.org/fhir/ValueSet/service-type); The specific service that is to be performed during this appointment**

 The specific service that is to be performed during this appointment.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "serviceType")]
    pub service_type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_serviceType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub service_type_ext: Vec<Option<FieldExtension>>,
    /** **[specialty](http://hl7.org/fhir/ValueSet/c80-practice-codes); The specialty of a practitioner that would be required to perform the service requested in this appointment**

 The specialty of a practitioner that would be required to perform the service requested in this appointment.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "specialty")]
    pub specialty: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_specialty")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub specialty_ext: Vec<Option<FieldExtension>>,
    /** **[appointment-type](http://hl7.org/fhir/ValueSet/v2-0276); The style of appointment or patient that has been booked in the slot (not service type)**

 The style of appointment or patient that has been booked in the slot (not service type).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "appointmentType")]
    pub appointment_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_appointmentType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub appointment_type_ext: Option<FieldExtension>,
    /** **[ApptReason](http://hl7.org/fhir/ValueSet/encounter-reason); Reason this appointment is scheduled**

 The reason that this appointment is being scheduled. This is more clinical than administrative.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reason")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_ext: Vec<Option<FieldExtension>>,
    /** **Reason the appointment is to takes place (resource)**

 Reason the appointment has been scheduled to take place, as specified using information from another resource. When the patient arrives and the encounter begins it may be used as the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "indication")]
    pub indication: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_indication")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub indication_ext: Vec<Option<FieldExtension>>,
    /** **Used to make informed decisions if needing to re-prioritize**

 The priority of the appointment. Can be used to make informed decisions if needing to re-prioritize appointments. (The iCal Standard specifies 0 as undefined, 1 as highest, 9 as lowest priority).

 Seeking implementer feedback on this property and how interoperable it is.

Using an extension to record a codeableconcept for named values may be tested at a future connectathon. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "priority")]
    pub priority: Option<u32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_priority")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub priority_ext: Option<FieldExtension>,
    /** **Shown on a subject line in a meeting request, or appointment list**

 The brief description of the appointment as would be shown on a subject line in a meeting request, or appointment list. Detailed or expanded information should be put in the comment field.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Additional information to support the appointment**

 Additional information to support the appointment provided when making the appointment.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "supportingInformation")]
    pub supporting_information: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_supportingInformation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub supporting_information_ext: Vec<Option<FieldExtension>>,
    /** **When appointment is to take place**

 Date/Time that the appointment is to take place.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "start")]
    pub start: Option<Instant>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_start")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub start_ext: Option<FieldExtension>,
    /** **When appointment is to conclude**

 Date/Time that the appointment is to conclude.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "end")]
    pub end: Option<Instant>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_end")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub end_ext: Option<FieldExtension>,
    /** **Can be less than start/end (e.g. estimate)**

 Number of minutes that the appointment is to take. This can be less than the duration between the start and end times (where actual time of appointment is only an estimate or is a planned appointment request).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "minutesDuration")]
    pub minutes_duration: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_minutesDuration")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub minutes_duration_ext: Option<FieldExtension>,
    /** **The slots that this appointment is filling**

 The slots from the participants' schedules that will be filled by the appointment.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "slot")]
    pub slot: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_slot")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub slot_ext: Vec<Option<FieldExtension>>,
    /** **The date that this appointment was initially created**

 The date that this appointment was initially created. This could be different to the meta.lastModified value on the initial entry, as this could have been before the resource was created on the FHIR server, and should remain unchanged over the lifespan of the appointment.

 This property is required for many use cases where the age of an appointment is considered in processing workflows for scheduling and billing of appointments. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "created")]
    pub created: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_created")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub created_ext: Option<FieldExtension>,
    /** **Additional comments**

 Additional comments about the appointment.

 Additional text to aid in facilitating the appointment. For instance, a comment might be, "patient should proceed immediately to infusion room upon arrival"

Where this is a planned appointment and the start/end dates are not set then this field can be used to provide additional guidance on the details of the appointment request, including any restrictions on when to book it. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "comment")]
    pub comment: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_comment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub comment_ext: Option<FieldExtension>,
    /** **The ReferralRequest provided as information to allocate to the Encounter**

 The referral request this appointment is allocated to assess (incoming referral).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "incomingReferral")]
    pub incoming_referral: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_incomingReferral")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub incoming_referral_ext: Vec<Option<FieldExtension>>,
    /** **Participants involved in appointment**

 List of participants involved in the appointment.

 */
    #[serde(rename = "participant")]
    pub participant: Vec<Option<AppointmentParticipant>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_participant")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub participant_ext: Vec<Option<FieldExtension>>,
    /** **Potential date/time interval(s) requested to allocate the appointment within**

 A set of date ranges (potentially including times) that the appointment is preferred to be scheduled within. When using these values, the minutes duration should be provided to indicate the length of the appointment to fill and populate the start/end times for the actual allocated time.

 This does not introduce a capacity for recurring appointments. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requestedPeriod")]
    pub requested_period: Vec<Option<Period>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_requestedPeriod")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub requested_period_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl AppointmentBuilder {
    #[doc = concat!("Finalize building ", "Appointment", ".")]
    pub fn build(self) -> Result<Appointment, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<AppointmentInner> for Appointment {
    fn from(inner: AppointmentInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Appointment {
    type Target = AppointmentInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Appointment {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Appointment {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> AppointmentBuilder {
        AppointmentBuilder::default()
    }
}
impl Appointment {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Appointment
    }
}
/// Sub-fields of the participant field in Appointment
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AppointmentParticipantBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AppointmentParticipant {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ParticipantType](http://hl7.org/fhir/ValueSet/encounter-participant-type); Role of participant in the appointment**

 Role of participant in the appointment.

 The role of the participant can be used to declare what the actor will be doing in the scope of this appointment.

If the actor is not specified, then it is expected that the actor will be filled in at a later stage of planning.

This value SHALL be the same when creating an AppointmentResponse so that they can be matched, and subsequently update the Appointment. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub r#type_ext: Vec<Option<FieldExtension>>,
    /** **Person, Location/HealthcareService or Device**

 A Person, Location/HealthcareService or Device that is participating in the appointment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "actor")]
    pub actor: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_actor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub actor_ext: Option<FieldExtension>,
    /** **[ParticipantRequired](http://hl7.org/fhir/ValueSet/participantrequired); required | optional | information-only**

 Is this participant required to be present at the meeting. This covers a use-case where 2 doctors need to meet to discuss the results for a specific patient, and the patient is not required to be present.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "required")]
    pub required: Option<codes::ParticipantRequired>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_required")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub required_ext: Option<FieldExtension>,
    /** **[ParticipationStatus](http://hl7.org/fhir/ValueSet/participationstatus); accepted | declined | tentative | needs-action**

 Participation status of the actor.

 */
    #[serde(rename = "status")]
    pub status: codes::ParticipationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl AppointmentParticipant {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AppointmentParticipantBuilder {
        AppointmentParticipantBuilder::default()
    }
}
/** Base StructureDefinition for AppointmentResponse Resource

 **[AppointmentResponse](http://hl7.org/fhir/StructureDefinition/AppointmentResponse) v3.0.2**

 A reply to an appointment request for a patient and/or practitioner(s), such as a confirmation or rejection

 A reply to an appointment request for a patient and/or practitioner(s), such as a confirmation or rejection.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct AppointmentResponse(pub Box<AppointmentResponseInner>);
/** Base StructureDefinition for AppointmentResponse Resource

 **[AppointmentResponse](http://hl7.org/fhir/StructureDefinition/AppointmentResponse) v3.0.2**

 A reply to an appointment request for a patient and/or practitioner(s), such as a confirmation or rejection

 A reply to an appointment request for a patient and/or practitioner(s), such as a confirmation or rejection.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AppointmentResponseBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct AppointmentResponseInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "AppointmentResponse::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::AppointmentResponse", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **External Ids for this item**

 This records identifiers associated with this appointment response concern that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Appointment this response relates to**

 Appointment that this response is replying to.

 */
    #[serde(rename = "appointment")]
    pub appointment: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_appointment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub appointment_ext: Option<FieldExtension>,
    /** **Time from appointment, or requested new start time**

 Date/Time that the appointment is to take place, or requested new start time.

 This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the start time. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "start")]
    pub start: Option<Instant>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_start")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub start_ext: Option<FieldExtension>,
    /** **Time from appointment, or requested new end time**

 This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the end time.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "end")]
    pub end: Option<Instant>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_end")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub end_ext: Option<FieldExtension>,
    /** **[ParticipantType](http://hl7.org/fhir/ValueSet/encounter-participant-type); Role of participant in the appointment**

 Role of participant in the appointment.

 The role of the participant can be used to declare what the actor will be doing in the scope of the referenced appointment.

If the actor is not specified, then it is expected that the actor will be filled in at a later stage of planning.

This value SHALL be the same as specified on the referenced Appointment so that they can be matched, and subsequently updated. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "participantType")]
    pub participant_type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_participantType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub participant_type_ext: Vec<Option<FieldExtension>>,
    /** **Person, Location/HealthcareService or Device**

 A Person, Location/HealthcareService or Device that is participating in the appointment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "actor")]
    pub actor: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_actor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub actor_ext: Option<FieldExtension>,
    /** **[ParticipantStatus](http://hl7.org/fhir/ValueSet/participationstatus); accepted | declined | tentative | in-process | completed | needs-action | entered-in-error**

 Participation status of the participant. When the status is declined or tentative if the start/end times are different to the appointment, then these times should be interpreted as a requested time change. When the status is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be empty.

 This element is labeled as a modifier because the status contains the code entered-in-error that marks the participant as not currently valid. */
    #[serde(rename = "participantStatus")]
    pub participant_status: codes::ParticipationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_participantStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub participant_status_ext: Option<FieldExtension>,
    /** **Additional comments**

 Additional comments about the appointment.

 This comment is particularly important when the responder is declining, tentatively accepting or requesting another time to indicate the reasons why. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "comment")]
    pub comment: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_comment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub comment_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl AppointmentResponseBuilder {
    #[doc = concat!("Finalize building ", "AppointmentResponse", ".")]
    pub fn build(self) -> Result<AppointmentResponse, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<AppointmentResponseInner> for AppointmentResponse {
    fn from(inner: AppointmentResponseInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for AppointmentResponse {
    type Target = AppointmentResponseInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for AppointmentResponse {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl AppointmentResponse {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> AppointmentResponseBuilder {
        AppointmentResponseBuilder::default()
    }
}
impl AppointmentResponse {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::AppointmentResponse
    }
}
/** Base StructureDefinition for AuditEvent Resource

 **[AuditEvent](http://hl7.org/fhir/StructureDefinition/AuditEvent) v3.0.2**

 Event record kept for security purposes

 A record of an event made for purposes of maintaining a security log. Typical uses include detection of intrusion attempts and monitoring for inappropriate usage.

 Based on ATNA (RFC 3881). */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct AuditEvent(pub Box<AuditEventInner>);
/** Base StructureDefinition for AuditEvent Resource

 **[AuditEvent](http://hl7.org/fhir/StructureDefinition/AuditEvent) v3.0.2**

 Event record kept for security purposes

 A record of an event made for purposes of maintaining a security log. Typical uses include detection of intrusion attempts and monitoring for inappropriate usage.

 Based on ATNA (RFC 3881). */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AuditEventBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct AuditEventInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "AuditEvent::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::AuditEvent", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[AuditEventType](http://hl7.org/fhir/ValueSet/audit-event-type); Type/identifier of event**

 Identifier for a family of the event.  For example, a menu item, program, rule, policy, function code, application name or URL. It identifies the performed function.

 */
    #[serde(rename = "type")]
    pub r#type: Coding,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[AuditEventSubType](http://hl7.org/fhir/ValueSet/audit-event-sub-type); More specific type/id for the event**

 Identifier for the category of event.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subtype")]
    pub subtype: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subtype")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub subtype_ext: Vec<Option<FieldExtension>>,
    /** **[AuditEventAction](http://hl7.org/fhir/ValueSet/audit-event-action); Type of action performed during the event**

 Indicator for type of action performed during the event that generated the audit.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "action")]
    pub action: Option<codes::AuditEventAction>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_action")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub action_ext: Option<FieldExtension>,
    /** **Time when the event occurred on source**

 The time when the event occurred on the source.

 In a distributed system, some sort of common time base (e.g. an NTP [RFC1305] server) is a good implementation tactic. */
    #[serde(rename = "recorded")]
    pub recorded: Instant,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_recorded")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub recorded_ext: Option<FieldExtension>,
    /** **[AuditEventOutcome](http://hl7.org/fhir/ValueSet/audit-event-outcome); Whether the event succeeded or failed**

 Indicates whether the event succeeded or failed.

 In some cases a "success" may be partial, for example, an incomplete or interrupted transfer of a radiological study. For the purpose of establishing accountability, these distinctions are not relevant. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "outcome")]
    pub outcome: Option<codes::AuditEventOutcome>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_outcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub outcome_ext: Option<FieldExtension>,
    /** **Description of the event outcome**

 A free text description of the outcome of the event.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "outcomeDesc")]
    pub outcome_desc: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_outcomeDesc")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub outcome_desc_ext: Option<FieldExtension>,
    /** **[AuditPurposeOfUse](http://hl7.org/fhir/ValueSet/v3-PurposeOfUse); The purposeOfUse of the event**

 The purposeOfUse (reason) that was used during the event being recorded.

 Use AuditEvent.agent.purposeOfUse when you know that it is specific to the agent, otherwise use AuditEvent.purposeOfEvent. For example, during a machine-to-machine transfer it might not be obvious to the audit system who caused the event, but it does know why. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purposeOfEvent")]
    pub purpose_of_event: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_purposeOfEvent")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub purpose_of_event_ext: Vec<Option<FieldExtension>>,
    /** **Actor involved in the event**

 An actor taking an active role in the event or activity that is logged.

 Several agents may be associated (i.e. have some responsibility for an activity) with an event or activity.

For example, an activity may be initiated by one user for other users or involve more than one user. However, only one user may be the initiator/requestor for the activity. */
    #[serde(rename = "agent")]
    pub agent: Vec<Option<AuditEventAgent>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_agent")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub agent_ext: Vec<Option<FieldExtension>>,
    /** **Audit Event Reporter**

 The system that is reporting the event.

 Since multi-tier, distributed, or composite applications make source identification ambiguous, this collection of fields may repeat for each application or process actively involved in the event. For example, multiple value-sets can identify participating web servers, application processes, and database server threads in an n-tier distributed application. Passive event participants (e.g. low-level network transports) need not be identified. */
    #[serde(rename = "source")]
    pub source: AuditEventSource,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_source")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_ext: Option<FieldExtension>,
    /** **Data or objects used**

 Specific instances of data or objects that have been accessed.

 Required unless the values for event identification, agent identification, and audit source identification are sufficient to document the entire auditable event. Because events may have more than one entity, this group can be a repeating set of values. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "entity")]
    pub entity: Vec<Option<AuditEventEntity>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_entity")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub entity_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl AuditEventBuilder {
    #[doc = concat!("Finalize building ", "AuditEvent", ".")]
    pub fn build(self) -> Result<AuditEvent, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<AuditEventInner> for AuditEvent {
    fn from(inner: AuditEventInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for AuditEvent {
    type Target = AuditEventInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for AuditEvent {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl AuditEvent {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> AuditEventBuilder {
        AuditEventBuilder::default()
    }
}
impl AuditEvent {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::AuditEvent
    }
}
/// Sub-fields of the agent field in AuditEvent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AuditEventAgentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AuditEventAgent {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[AuditAgentRole](http://hl7.org/fhir/ValueSet/security-role-type); Agent role in the event**

 The security role that the user was acting under, that come from local codes defined by the access control security system (e.g. RBAC, ABAC) used in the local context.

 Should be roles relevant to the event. Should  not be an exhaustive list of roles. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "role")]
    pub role: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_role")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub role_ext: Vec<Option<FieldExtension>>,
    /** **Direct reference to resource**

 Direct reference to a resource that identifies the agent.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reference")]
    pub reference: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reference_ext: Option<FieldExtension>,
    /** **Unique identifier for the user**

 Unique identifier for the user actively participating in the event.

 A unique value within the Audit Source ID. For node-based authentication -- where only the system hardware or process, but not a human user, is identified -- User ID would be the node name. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "userId")]
    pub user_id: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_userId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub user_id_ext: Option<FieldExtension>,
    /** **Alternative User id e.g. authentication**

 Alternative agent Identifier. For a human, this should be a user identifier text string from authentication system. This identifier would be one known to a common authentication system (e.g. single sign-on), if available.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "altId")]
    pub alt_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_altId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub alt_id_ext: Option<FieldExtension>,
    /** **Human-meaningful name for the agent**

 Human-meaningful name for the agent.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Whether user is initiator**

 Indicator that the user is or is not the requestor, or initiator, for the event being audited.

 There can only be one initiator. If the initiator is not clear, then do not choose any one agent as the initiator. */
    #[serde(rename = "requestor")]
    pub requestor: bool,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requestor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub requestor_ext: Option<FieldExtension>,
    /** **Where**

 Where the event occurred.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "location")]
    pub location: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_location")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub location_ext: Option<FieldExtension>,
    /** **Policy that authorized event**

 The policy or plan that authorized the activity being recorded. Typically, a single activity may have multiple applicable policies, such as patient consent, guarantor funding, etc. The policy would also indicate the security token used.

 For example: Where an OAuth token authorizes, the unique identifier from the OAuth token is placed into the policy element Where a policy engine (e.g. XACML) holds policy logic, the unique policy identifier is placed into the policy element. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "policy")]
    pub policy: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_policy")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub policy_ext: Vec<Option<FieldExtension>>,
    /** **[DICOMMediaType](http://hl7.org/fhir/ValueSet/dicm-405-mediatype); Type of media**

 Type of media involved. Used when the event is about exporting/importing onto media.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "media")]
    pub media: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_media")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub media_ext: Option<FieldExtension>,
    /** **Logical network location for application activity**

 Logical network location for application activity, if the activity has a network location.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "network")]
    pub network: Option<AuditEventAgentNetwork>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_network")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub network_ext: Option<FieldExtension>,
    /** **[AuditPurposeOfUse](http://hl7.org/fhir/ValueSet/v3-PurposeOfUse); Reason given for this user**

 The reason (purpose of use), specific to this agent, that was used during the event being recorded.

 Use AuditEvent.agent.purposeOfUse when you know that is specific to the agent, otherwise use AuditEvent.purposeOfEvent. For example, during a machine-to-machine transfer it might not be obvious to the audit system who caused the event, but it does know why. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purposeOfUse")]
    pub purpose_of_use: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_purposeOfUse")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub purpose_of_use_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl AuditEventAgent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AuditEventAgentBuilder {
        AuditEventAgentBuilder::default()
    }
}
/// Sub-fields of the network field in AuditEventAgent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AuditEventAgentNetworkBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AuditEventAgentNetwork {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Identifier for the network access point of the user device**

 An identifier for the network access point of the user device for the audit event.

 This could be a device id, IP address or some other identifier associated with a device. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "address")]
    pub address: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_address")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub address_ext: Option<FieldExtension>,
    /** **[AuditEventAgentNetworkType](http://hl7.org/fhir/ValueSet/network-type); The type of network access point**

 An identifier for the type of network access point that originated the audit event.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<codes::AuditEventAgentNetworkType>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl AuditEventAgentNetwork {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AuditEventAgentNetworkBuilder {
        AuditEventAgentNetworkBuilder::default()
    }
}
/// Sub-fields of the source field in AuditEvent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AuditEventSourceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AuditEventSource {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical source location within the enterprise**

 Logical source location within the healthcare enterprise network.  For example, a hospital or other provider location within a multi-entity provider group.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "site")]
    pub site: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_site")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub site_ext: Option<FieldExtension>,
    /** **The identity of source detecting the event**

 Identifier of the source where the event was detected.

 */
    #[serde(rename = "identifier")]
    pub identifier: Identifier,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **[AuditEventSourceType](http://hl7.org/fhir/ValueSet/audit-source-type); The type of source where event originated**

 Code specifying the type of source where event originated.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub r#type_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl AuditEventSource {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AuditEventSourceBuilder {
        AuditEventSourceBuilder::default()
    }
}
/// Sub-fields of the entity field in AuditEvent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AuditEventEntityBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AuditEventEntity {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Specific instance of object**

 Identifies a specific instance of the entity. The reference should always be version specific.

 Identifier detail depends on entity type. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **Specific instance of resource**

 Identifies a specific instance of the entity. The reference should be version specific.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reference")]
    pub reference: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reference_ext: Option<FieldExtension>,
    /** **[AuditEventEntityType](http://hl7.org/fhir/ValueSet/audit-entity-type); Type of entity involved**

 The type of the object that was involved in this audit event.

 This value is distinct from the user's role or any user relationship to the entity. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[AuditEventEntityRole](http://hl7.org/fhir/ValueSet/object-role); What role the entity played**

 Code representing the role the entity played in the event being audited.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "role")]
    pub role: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_role")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub role_ext: Option<FieldExtension>,
    /** **[AuditEventEntityLifecycle](http://hl7.org/fhir/ValueSet/object-lifecycle-events); Life-cycle stage for the entity**

 Identifier for the data life-cycle stage for the entity.

 This can be used to provide an audit trail for data, over time, as it passes through the system. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "lifecycle")]
    pub lifecycle: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_lifecycle")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub lifecycle_ext: Option<FieldExtension>,
    /** **[SecurityLabels](http://hl7.org/fhir/ValueSet/security-labels); Security labels on the entity**

 Security labels for the identified entity.

 Copied from entity meta security tags. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "securityLabel")]
    pub security_label: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_securityLabel")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub security_label_ext: Vec<Option<FieldExtension>>,
    /** **Descriptor for entity**

 A name of the entity in the audit event.

 This field may be used in a query/report to identify audit events for a specific person.  For example, where multiple synonymous entity identifiers (patient number, medical record number, encounter number, etc.) have been used. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Descriptive text**

 Text that describes the entity in more detail.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Query parameters**

 The query parameters for a query-type entities.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "query")]
    pub query: Option<Base64Binary>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_query")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub query_ext: Option<FieldExtension>,
    /** **Additional Information about the entity**

 Tagged value pairs for conveying additional information about the entity.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "detail")]
    pub detail: Vec<Option<AuditEventEntityDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_detail")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub detail_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl AuditEventEntity {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AuditEventEntityBuilder {
        AuditEventEntityBuilder::default()
    }
}
/// Sub-fields of the detail field in AuditEventEntity
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "AuditEventEntityDetailBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct AuditEventEntityDetail {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Name of the property**

 The type of extra detail provided in the value.

 */
    #[serde(rename = "type")]
    pub r#type: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Property value**

 The details, base64 encoded. Used to carry bulk information.

 The value is base64 encoded to enable various encodings or binary content. */
    #[serde(rename = "value")]
    pub value: Base64Binary,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_value")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl AuditEventEntityDetail {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> AuditEventEntityDetailBuilder {
        AuditEventEntityDetailBuilder::default()
    }
}
/** Base StructureDefinition for Basic Resource

 **[Basic](http://hl7.org/fhir/StructureDefinition/Basic) v3.0.2**

 Resource for non-supported content

 Basic is used for handling concepts not yet defined in FHIR, narrative-only resources that don't map to an existing resource, and custom resources not appropriate for inclusion in the FHIR specification.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Basic(pub Box<BasicInner>);
/** Base StructureDefinition for Basic Resource

 **[Basic](http://hl7.org/fhir/StructureDefinition/Basic) v3.0.2**

 Resource for non-supported content

 Basic is used for handling concepts not yet defined in FHIR, narrative-only resources that don't map to an existing resource, and custom resources not appropriate for inclusion in the FHIR specification.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "BasicBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct BasicInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Basic::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Basic", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business identifier**

 Identifier assigned to the resource for business purposes, outside the context of FHIR.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[BasicResourceType](http://hl7.org/fhir/ValueSet/basic-resource-type); Kind of Resource**

 Identifies the 'type' of resource - equivalent to the resource name for other resources.

 Because resource references will only be able to indicate 'Basic', the type of reference will need to be specified in a Profile identified as part of the resource.  Refer to the resource notes section for information on appropriate terminologies for this code.

This element is labeled as a modifier because the it defines the meaning of the resource and cannot be ignored. */
    #[serde(rename = "code")]
    pub code: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Identifies the focus of this resource**

 Identifies the patient, practitioner, device or any other resource that is the "focus" of this resource.

 Optional as not all potential resources will have subjects.  Resources associated with multiple subjects can handle this via extension. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **When created**

 Identifies when the resource was first created.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "created")]
    pub created: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_created")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub created_ext: Option<FieldExtension>,
    /** **Who created**

 Indicates who was responsible for creating the resource instance.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_author")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub author_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl BasicBuilder {
    #[doc = concat!("Finalize building ", "Basic", ".")]
    pub fn build(self) -> Result<Basic, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<BasicInner> for Basic {
    fn from(inner: BasicInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Basic {
    type Target = BasicInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Basic {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Basic {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> BasicBuilder {
        BasicBuilder::default()
    }
}
impl Basic {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Basic
    }
}
/** Base StructureDefinition for Binary Resource

 **[Binary](http://hl7.org/fhir/StructureDefinition/Binary) v3.0.2**

 Pure binary content defined by a format other than FHIR

 A binary resource can contain any content, whether text, image, pdf, zip archive, etc.

 Typically, Binary resources are used for handling content such as:  * CDA Documents (i.e. with XDS) * PDF Documents * Images (the Media resource is preferred for handling images, but not possible when the content is already binary - e.g. XDS). */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Binary(pub Box<BinaryInner>);
/** Base StructureDefinition for Binary Resource

 **[Binary](http://hl7.org/fhir/StructureDefinition/Binary) v3.0.2**

 Pure binary content defined by a format other than FHIR

 A binary resource can contain any content, whether text, image, pdf, zip archive, etc.

 Typically, Binary resources are used for handling content such as:  * CDA Documents (i.e. with XDS) * PDF Documents * Images (the Media resource is preferred for handling images, but not possible when the content is already binary - e.g. XDS). */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "BinaryBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct BinaryInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Binary::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Binary", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **[MimeType](http://www.rfc-editor.org/bcp/bcp13.txt); MimeType of the binary content**

 MimeType of the binary content represented as a standard MimeType (BCP 13).

 */
    #[serde(rename = "contentType")]
    pub content_type: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_contentType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub content_type_ext: Option<FieldExtension>,
    /** **Access Control Management**

 Treat this binary as if it was this other resource for access control purposes.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "securityContext")]
    pub security_context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_securityContext")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub security_context_ext: Option<FieldExtension>,
    /** **The actual content**

 The actual content, base64 encoded.

 If the content type is itself base64 encoding, then this will be base64 encoded twice - what is created by un-base64ing the content must be the specified content type. */
    #[serde(rename = "content")]
    pub content: Base64Binary,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_content")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub content_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl BinaryBuilder {
    #[doc = concat!("Finalize building ", "Binary", ".")]
    pub fn build(self) -> Result<Binary, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<BinaryInner> for Binary {
    fn from(inner: BinaryInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Binary {
    type Target = BinaryInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Binary {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Binary {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> BinaryBuilder {
        BinaryBuilder::default()
    }
}
impl Binary {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Binary
    }
}
/** Base StructureDefinition for BodySite Resource

 **[BodySite](http://hl7.org/fhir/StructureDefinition/BodySite) v3.0.2**

 Specific and identified anatomical location

 Record details about the anatomical location of a specimen or body part.  This resource may be used when a coded concept does not provide the necessary detail needed for the use case.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct BodySite(pub Box<BodySiteInner>);
/** Base StructureDefinition for BodySite Resource

 **[BodySite](http://hl7.org/fhir/StructureDefinition/BodySite) v3.0.2**

 Specific and identified anatomical location

 Record details about the anatomical location of a specimen or body part.  This resource may be used when a coded concept does not provide the necessary detail needed for the use case.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "BodySiteBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct BodySiteInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "BodySite::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::BodySite", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Bodysite identifier**

 Identifier for this instance of the anatomical location.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Whether this body site record is in active use**

 Whether this body site is in active use.

 This element is labeled as a modifier because it may be used to mark that the resource was created in error. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "active")]
    pub active: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_active")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub active_ext: Option<FieldExtension>,
    /** **[BodySite](http://hl7.org/fhir/ValueSet/body-site); Named anatomical location**

 Named anatomical location - ideally coded where possible.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **[BodySiteQualifier](http://hl7.org/fhir/ValueSet/bodysite-relative-location); Modification to location code**

 Qualifier to refine the anatomical location.  These include qualifiers for laterality, relative location, directionality, number, and plane.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "qualifier")]
    pub qualifier: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_qualifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub qualifier_ext: Vec<Option<FieldExtension>>,
    /** **Anatomical location description**

 A summary, charactarization or explanation of the anatomic location.

 This description could include any visual markings used to orientate the viewer e.g. external reference points, special sutures, ink markings. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Attached images**

 Image or images used to identify a location.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "image")]
    pub image: Vec<Option<Attachment>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_image")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub image_ext: Vec<Option<FieldExtension>>,
    /** **Who this is about**

 The person to which the body site belongs.

 */
    #[serde(rename = "patient")]
    pub patient: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl BodySiteBuilder {
    #[doc = concat!("Finalize building ", "BodySite", ".")]
    pub fn build(self) -> Result<BodySite, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<BodySiteInner> for BodySite {
    fn from(inner: BodySiteInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for BodySite {
    type Target = BodySiteInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for BodySite {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl BodySite {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> BodySiteBuilder {
        BodySiteBuilder::default()
    }
}
impl BodySite {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::BodySite
    }
}
/** Base StructureDefinition for Bundle Resource

 **[Bundle](http://hl7.org/fhir/StructureDefinition/Bundle) v3.0.2**

 Contains a collection of resources

 A container for a collection of resources.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Bundle(pub Box<BundleInner>);
/** Base StructureDefinition for Bundle Resource

 **[Bundle](http://hl7.org/fhir/StructureDefinition/Bundle) v3.0.2**

 Contains a collection of resources

 A container for a collection of resources.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "BundleBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct BundleInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Bundle::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Bundle", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Persistent identifier for the bundle**

 A persistent identifier for the batch that won't change as a batch is copied from server to server.

 Persistent identity generally only matters for batches of type Document, Message, and Collection. It would not normally be populated for search and history results, and servers ignore Bundle.identifier when processing batches and transactions. For Documents  the .identifier SHALL be populated such that the .identifier is globally unique. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **[BundleType](http://hl7.org/fhir/ValueSet/bundle-type); document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection**

 Indicates the purpose of this bundle - how it was intended to be used.

 It's possible to use a bundle for other purposes (e.g. a document can be accepted as a transaction). This is primarily defined so that there can be specific rules for some of the bundle types. */
    #[serde(rename = "type")]
    pub r#type: codes::BundleType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **If search, the total number of matches**

 If a set of search matches, this is the total number of matches for the search (as opposed to the number of results in this bundle).

 Only used if the bundle is a search result set. The total does not include resources such as OperationOutcome and included resources, only the total number of matching resources. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "total")]
    pub total: Option<u32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_total")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub total_ext: Option<FieldExtension>,
    /** **Links related to this Bundle**

 A series of links that provide context to this bundle.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "link")]
    pub link: Vec<Option<BundleLink>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_link")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub link_ext: Vec<Option<FieldExtension>>,
    /** **Entry in the bundle - will have a resource, or information**

 An entry in a bundle resource - will either contain a resource, or information about a resource (transactions and history only).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "entry")]
    pub entry: Vec<Option<BundleEntry>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_entry")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub entry_ext: Vec<Option<FieldExtension>>,
    /** **Digital Signature**

 Digital Signature - base64 encoded. XML-DSIg or a JWT.

 The signature could be created by the "author" of the bundle or by the originating device.   Requirements around inclusion of a signature, verification of signatures and treatment of signed/non-signed bundles is implementation-environment specific. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "signature")]
    pub signature: Option<Signature>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_signature")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub signature_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl BundleBuilder {
    #[doc = concat!("Finalize building ", "Bundle", ".")]
    pub fn build(self) -> Result<Bundle, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<BundleInner> for Bundle {
    fn from(inner: BundleInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Bundle {
    type Target = BundleInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Bundle {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Bundle {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> BundleBuilder {
        BundleBuilder::default()
    }
}
impl Bundle {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Bundle
    }
}
/// Sub-fields of the link field in Bundle
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "BundleLinkBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct BundleLink {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **See http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1**

 A name which details the functional use for this link - see [http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1](http://www.iana.org/assignments/link-relations/link-relations.xhtml#link-relations-1).

 */
    #[serde(rename = "relation")]
    pub relation: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_relation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub relation_ext: Option<FieldExtension>,
    /** **Reference details for the link**

 The reference details for the link.

 */
    #[serde(rename = "url")]
    pub url: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl BundleLink {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> BundleLinkBuilder {
        BundleLinkBuilder::default()
    }
}
/// Sub-fields of the entry field in Bundle
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "BundleEntryBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct BundleEntry {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Links related to this entry**

 A series of links that provide context to this entry.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "link")]
    pub link: Vec<Option<BundleLink>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_link")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub link_ext: Vec<Option<FieldExtension>>,
    /** **Absolute URL for resource (server address, or UUID/OID)**

 The Absolute URL for the resource.  The fullUrl SHALL not disagree with the id in the resource. The fullUrl is a version independent reference to the resource. The fullUrl element SHALL have a value except that:
* fullUrl can be empty on a POST (although it does not need to when specifying a temporary id for reference in the bundle)
* Results from operations might involve resources that are not identified.

 fullUrl may not be [unique in the context of a resource](bundle.html#bundle-unique). Note that since [FHIR resources do not need to be served through the FHIR API](references.html), the absolute URL may not end with the logical id of the resource (Resource.id), but if the fullUrl does look like a RESTful server URL (e.g. meets the [regex](references.html#regex), then it SHALL end with the Resource.id. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "fullUrl")]
    pub full_url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_fullUrl")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub full_url_ext: Option<FieldExtension>,
    /** **A resource in the bundle**

 The Resources for the entry.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "resource")]
    pub resource: Option<Resource>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_resource")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub resource_ext: Option<FieldExtension>,
    /** **Search related information**

 Information about the search process that lead to the creation of this entry.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "search")]
    pub search: Option<BundleEntrySearch>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_search")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub search_ext: Option<FieldExtension>,
    /** **Transaction Related Information**

 Additional information about how this entry should be processed as part of a transaction.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "request")]
    pub request: Option<BundleEntryRequest>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_request")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_ext: Option<FieldExtension>,
    /** **Transaction Related Information**

 Additional information about how this entry should be processed as part of a transaction.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "response")]
    pub response: Option<BundleEntryResponse>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_response")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub response_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl BundleEntry {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> BundleEntryBuilder {
        BundleEntryBuilder::default()
    }
}
/// Sub-fields of the search field in BundleEntry
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "BundleEntrySearchBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct BundleEntrySearch {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[SearchEntryMode](http://hl7.org/fhir/ValueSet/search-entry-mode); match | include | outcome - why this is in the result set**

 Why this entry is in the result set - whether it's included as a match or because of an _include requirement.

 There is only one mode. In some corner cases, a resource may be included because it is both a match and an include. In these circumstances, 'match' takes precedence. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "mode")]
    pub mode: Option<codes::SearchEntryMode>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_mode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub mode_ext: Option<FieldExtension>,
    /** **Search ranking (between 0 and 1)**

 When searching, the server's search ranking score for the entry.

 Servers are not required to return a ranking score. 1 is most relevant, and 0 is least relevant. Often, search results are sorted by score, but the client may specify a different sort order. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "score")]
    pub score: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_score")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub score_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl BundleEntrySearch {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> BundleEntrySearchBuilder {
        BundleEntrySearchBuilder::default()
    }
}
/// Sub-fields of the request field in BundleEntry
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "BundleEntryRequestBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct BundleEntryRequest {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[HTTPVerb](http://hl7.org/fhir/ValueSet/http-verb); GET | POST | PUT | DELETE**

 The HTTP verb for this entry in either a change history, or a transaction/ transaction response.

 */
    #[serde(rename = "method")]
    pub method: codes::HTTPVerb,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_method")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub method_ext: Option<FieldExtension>,
    /** **URL for HTTP equivalent of this entry**

 The URL for this entry, relative to the root (the address to which the request is posted).

 E.g. for a Patient Create, the method would be "POST" and the URL would be "Patient". For a Patient Update, the method would be PUT, and the URL would be "Patient/[id]". */
    #[serde(rename = "url")]
    pub url: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **For managing cache currency**

 If the ETag values match, return a 304 Not Modified status. See the API documentation for ["Conditional Read"](http.html#cread).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "ifNoneMatch")]
    pub if_none_match: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_ifNoneMatch")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub if_none_match_ext: Option<FieldExtension>,
    /** **For managing update contention**

 Only perform the operation if the last updated date matches. See the API documentation for ["Conditional Read"](http.html#cread).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "ifModifiedSince")]
    pub if_modified_since: Option<Instant>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_ifModifiedSince")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub if_modified_since_ext: Option<FieldExtension>,
    /** **For managing update contention**

 Only perform the operation if the Etag value matches. For more information, see the API section ["Managing Resource Contention"](http.html#concurrency).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "ifMatch")]
    pub if_match: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_ifMatch")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub if_match_ext: Option<FieldExtension>,
    /** **For conditional creates**

 Instruct the server not to perform the create if a specified resource already exists. For further information, see the API documentation for ["Conditional Create"](http.html#ccreate). This is just the query portion of the URL - what follows the "?" (not including the "?").

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "ifNoneExist")]
    pub if_none_exist: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_ifNoneExist")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub if_none_exist_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl BundleEntryRequest {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> BundleEntryRequestBuilder {
        BundleEntryRequestBuilder::default()
    }
}
/// Sub-fields of the response field in BundleEntry
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "BundleEntryResponseBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct BundleEntryResponse {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Status response code (text optional)**

 The status code returned by processing this entry. The status SHALL start with a 3 digit HTTP code (e.g. 404) and may contain the standard HTTP description associated with the status code.

 */
    #[serde(rename = "status")]
    pub status: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **The location, if the operation returns a location**

 The location header created by processing this operation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "location")]
    pub location: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_location")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub location_ext: Option<FieldExtension>,
    /** **The etag for the resource (if relevant)**

 The etag for the resource, it the operation for the entry produced a versioned resource (see [Resource Metadata and Versioning](http.html#versioning) and [Managing Resource Contention](http.html#concurrency)).

 Etags match the Resource.meta.versionId. The ETag has to match the version id in the header if a resource is included. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "etag")]
    pub etag: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_etag")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub etag_ext: Option<FieldExtension>,
    /** **Server's date time modified**

 The date/time that the resource was modified on the server.

 This has to match the same time in the meta header if a resource is included. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "lastModified")]
    pub last_modified: Option<Instant>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_lastModified")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub last_modified_ext: Option<FieldExtension>,
    /** **OperationOutcome with hints and warnings (for batch/transaction)**

 An OperationOutcome containing hints and warnings produced as part of processing this entry in a batch or transaction.

 For a POST/PUT operation, this is the equivalent outcome that would be returned for prefer = operationoutcome - except that the resource is always returned whether or not the outcome is returned. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "outcome")]
    pub outcome: Option<Resource>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_outcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub outcome_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl BundleEntryResponse {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> BundleEntryResponseBuilder {
        BundleEntryResponseBuilder::default()
    }
}
/** Base StructureDefinition for CapabilityStatement Resource

 **[CapabilityStatement](http://hl7.org/fhir/StructureDefinition/CapabilityStatement) v3.0.2**

 A statement of system capabilities

 A Capability Statement documents a set of capabilities (behaviors) of a FHIR Server that may be used as a statement of actual server functionality or a statement of required or desired server implementation.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct CapabilityStatement(pub Box<CapabilityStatementInner>);
/** Base StructureDefinition for CapabilityStatement Resource

 **[CapabilityStatement](http://hl7.org/fhir/StructureDefinition/CapabilityStatement) v3.0.2**

 A statement of system capabilities

 A Capability Statement documents a set of capabilities (behaviors) of a FHIR Server that may be used as a statement of actual server functionality or a statement of required or desired server implementation.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CapabilityStatementBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct CapabilityStatementInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "CapabilityStatement::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::CapabilityStatement", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical URI to reference this capability statement (globally unique)**

 An absolute URI that is used to identify this capability statement when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this capability statement is (or will be) published. The URL SHOULD include the major version of the capability statement. For more information see [Technical and Business Versions](resource.html#versions).

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred.  Multiple instances may share the same url if they have a distinct version. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "url")]
    pub url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Business version of the capability statement**

 The identifier that is used to identify this version of the capability statement when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the capability statement author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.

 There may be different capability statement instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a refrence to a particular business version of the capability statement with the format [url]|[version]. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Name for this capability statement (computer friendly)**

 A natural language name identifying the capability statement. This name should be usable as an identifier for the module by machine processing applications such as code generation.

 The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure that it is computable friendly. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Name for this capability statement (human friendly)**

 A short, descriptive, user-friendly title for the capability statement.

 This name does not need to be machine-processing friendly and may contain punctuation, white-space, etc. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this capability statement. Enables tracking the life-cycle of the content.

 Allows filtering of capability statements that are appropriate for use vs. not.
This is labeled as "Is Modifier" because applications should not use a retired capability statement without due consideration. This is not intended for use with actual capability statements, but where capability statements are used to describe possible or desired systems. */
    #[serde(rename = "status")]
    pub status: codes::PublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **For testing purposes, not real usage**

 A boolean value to indicate that this capability statement is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of capability statement that are appropriate for use vs. not. This is labeled as "Is Modifier" because applications should not use an experimental capability statement in production. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "experimental")]
    pub experimental: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_experimental")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub experimental_ext: Option<FieldExtension>,
    /** **Date this was last changed**

 The date  (and optionally time) when the capability statement was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the capability statement changes.

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the capability statement. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource. */
    #[serde(rename = "date")]
    pub date: DateTime,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Name of the publisher (organization or individual)**

 The name of the individual or organization that published the capability statement.

 Usually an organization, but may be an individual. The publisher (or steward) of the capability statement is the organization or individual primarily responsible for the maintenance and upkeep of the capability statement. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the capability statement. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisher")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_ext: Option<FieldExtension>,
    /** **Contact details for the publisher**

 Contact details to assist a user in finding and communicating with the publisher.

 May be a web site, an email address, a telephone number, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Natural language description of the capability statement**

 A free text natural language description of the capability statement from a consumer's perspective. Typically, this is used when the capability statement describes a desired rather than an actual solution, for example as a formal expression of requirements as part of an RFP.

 This description can be used to capture details such as why the capability statement was built, comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the capability statement as conveyed in the 'text' field of the resource itself. This item SHOULD be populated unless the information is available from context (e.g. the language of the profile is presumed to be the predominant language in the place the profile was created). This does not need to be populated if the description is adequately implied by the software or implementation details. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Context the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate capability statement instances.

 When multiple useContexts are specified, there is no expectation whether all or any of the contexts apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useContext")]
    pub use_context: Vec<Option<UsageContext>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_useContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_context_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Intended jurisdiction for capability statement (if applicable)**

 A legal or geographic region in which the capability statement is intended to be used.

 It may be possible for the capability statement to be used in jurisdictions other than those for which it was originally designed or intended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **Why this capability statement is defined**

 Explaination of why this capability statement is needed and why it has been designed as it has.

 This element does not describe the usage of the capability statement Instead  it provides traceability of ''why'' the resource is either needed or ''why'' it is defined as it is.  This may be used to point to source materials or specifications that drove the structure of this capability statement. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purpose")]
    pub purpose: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_purpose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub purpose_ext: Option<FieldExtension>,
    /** **Use and/or publishing restrictions**

 A copyright statement relating to the capability statement and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the capability statement.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyright")]
    pub copyright: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyright")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_ext: Option<FieldExtension>,
    /** **[CapabilityStatementKind](http://hl7.org/fhir/ValueSet/capability-statement-kind); instance | capability | requirements**

 The way that this statement is intended to be used, to describe an actual running instance of software, a particular product (kind not instance of software) or a class of implementation (e.g. a desired purchase).

 */
    #[serde(rename = "kind")]
    pub kind: codes::CapabilityStatementKind,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_kind")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub kind_ext: Option<FieldExtension>,
    /** **Canonical URL of another capability statement this implements**

 Reference to a canonical URL of another CapabilityStatement that this software implements or uses. This capability statement is a published API description that corresponds to a business service. The rest of the capability statement does not need to repeat the details of the referenced resource, but can do so.

 HL7 defines the following Services: [Terminology Service](terminology-service.html).

Many [Implementation Guides](http://fhir.org/guides/registry) define additional services. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instantiates")]
    pub instantiates: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_instantiates")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub instantiates_ext: Vec<Option<FieldExtension>>,
    /** **Software that is covered by this capability statement**

 Software that is covered by this capability statement.  It is used when the capability statement describes the capabilities of a particular software version, independent of an installation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "software")]
    pub software: Option<CapabilityStatementSoftware>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_software")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub software_ext: Option<FieldExtension>,
    /** **If this describes a specific instance**

 Identifies a specific implementation instance that is described by the capability statement - i.e. a particular installation, rather than the capabilities of a software program.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implementation")]
    pub implementation: Option<CapabilityStatementImplementation>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_implementation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub implementation_ext: Option<FieldExtension>,
    /** **FHIR Version the system uses**

 The version of the FHIR specification on which this capability statement is based.

 */
    #[serde(rename = "fhirVersion")]
    pub fhir_version: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_fhirVersion")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub fhir_version_ext: Option<FieldExtension>,
    /** **[UnknownContentCode](http://hl7.org/fhir/ValueSet/unknown-content-code); no | extensions | elements | both**

 A code that indicates whether the application accepts unknown elements or extensions when reading resources.

 Unknown elements in a resource can only arise as later versions of the specification are published, because this is the only place where such elements can be defined. Hence accepting unknown elements is about inter-version compatibility.

Applications are recommended to accept unknown extensions and elements ('both'), but this is not always possible. */
    #[serde(rename = "acceptUnknown")]
    pub accept_unknown: codes::UnknownContentCode,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_acceptUnknown")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub accept_unknown_ext: Option<FieldExtension>,
    /** **[MimeType](http://www.rfc-editor.org/bcp/bcp13.txt); formats supported (xml | json | ttl | mime type)**

 A list of the formats supported by this implementation using their content types.

 "xml", "json" and "ttl" are allowed, which describe the simple encodings described in the specification (and imply appropriate bundle support). Otherwise, mime types are legal here. */
    #[serde(rename = "format")]
    pub format: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_format")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub format_ext: Vec<Option<FieldExtension>>,
    /** **[MimeType](http://www.rfc-editor.org/bcp/bcp13.txt); Patch formats supported**

 A list of the patch formats supported by this implementation using their content types.

 At present, the patch mime types application/json-patch+json and application/xml-patch+xml are legal. Generally, if a server supports PATCH, it would be expected to support the patch formats and match the formats it supports, but this is not always possible or necessary. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patchFormat")]
    pub patch_format: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_patchFormat")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub patch_format_ext: Vec<Option<FieldExtension>>,
    /** **Implementation guides supported**

 A list of implementation guides that the server does (or should) support in their entirety.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implementationGuide")]
    pub implementation_guide: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_implementationGuide")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub implementation_guide_ext: Vec<Option<FieldExtension>>,
    /** **Profiles for use cases supported**

 A list of profiles that represent different use cases supported by the system. For a server, "supported by the system" means the system hosts/produces a set of resources that are conformant to a particular profile, and allows clients that use its services to search using this profile and to find appropriate data. For a client, it means the system will search by this profile and process data according to the guidance implicit in the profile. See further discussion in [Using Profiles](profiling.html#profile-uses).

 Supported profiles are different than the profiles that apply to a particular resource in rest.resource.profile. The resource profile is a general statement of what features of the resource are supported overall by the system - the sum total of the facilities it supports. A supported profile is a deeper statement about the functionality of the data and services provided by the server (or used by the client). A typical case is a laboratory system that produces a set of different reports - this is the list of types of data that it publishes. A key aspect of declaring profiles here is the question of how the client converts knowledge that the server publishes this data into working with the data; the client can inspect individual resources to determine whether they conform to a particular profile, but how does it find the ones that does? It does so by searching using the _profile parameter, so any resources listed here must be valid values for the _profile resource (using the identifier in the target profile).  Typically, supported profiles cross resource types to describe a network of related resources, so they are listed here rather than by resource. However, they do not need to describe more than one resource. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "profile")]
    pub profile: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_profile")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub profile_ext: Vec<Option<FieldExtension>>,
    /** **If the endpoint is a RESTful one**

 A definition of the restful capabilities of the solution, if any.

 Multiple repetitions allow definition of both client and/or server behaviors or possibly behaviors under different configuration settings (for software or requirements statements). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "rest")]
    pub rest: Vec<Option<CapabilityStatementRest>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_rest")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub rest_ext: Vec<Option<FieldExtension>>,
    /** **If messaging is supported**

 A description of the messaging capabilities of the solution.

 Multiple repetitions allow the documentation of multiple endpoints per solution. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "messaging")]
    pub messaging: Vec<Option<CapabilityStatementMessaging>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_messaging")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub messaging_ext: Vec<Option<FieldExtension>>,
    /** **Document definition**

 A document definition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "document")]
    pub document: Vec<Option<CapabilityStatementDocument>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_document")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub document_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl CapabilityStatementBuilder {
    #[doc = concat!("Finalize building ", "CapabilityStatement", ".")]
    pub fn build(self) -> Result<CapabilityStatement, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<CapabilityStatementInner> for CapabilityStatement {
    fn from(inner: CapabilityStatementInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for CapabilityStatement {
    type Target = CapabilityStatementInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for CapabilityStatement {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl CapabilityStatement {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> CapabilityStatementBuilder {
        CapabilityStatementBuilder::default()
    }
}
impl CapabilityStatement {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::CapabilityStatement
    }
}
/// Sub-fields of the software field in CapabilityStatement
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CapabilityStatementSoftwareBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CapabilityStatementSoftware {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **A name the software is known by**

 Name software is known by.

 */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Version covered by this statement**

 The version identifier for the software covered by this statement.

 If possible, a version should be specified, as statements are likely to be different for different versions of software. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Date this version released**

 Date this version of the software was released.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "releaseDate")]
    pub release_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_releaseDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub release_date_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CapabilityStatementSoftware {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CapabilityStatementSoftwareBuilder {
        CapabilityStatementSoftwareBuilder::default()
    }
}
/// Sub-fields of the implementation field in CapabilityStatement
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CapabilityStatementImplementationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CapabilityStatementImplementation {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Describes this specific instance**

 Information about the specific installation that this capability statement relates to.

 */
    #[serde(rename = "description")]
    pub description: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Base URL for the installation**

 An absolute base URL for the implementation.  This forms the base for REST interfaces as well as the mailbox and document interfaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "url")]
    pub url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CapabilityStatementImplementation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CapabilityStatementImplementationBuilder {
        CapabilityStatementImplementationBuilder::default()
    }
}
/// Sub-fields of the rest field in CapabilityStatement
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CapabilityStatementRestBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CapabilityStatementRest {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[RestfulCapabilityMode](http://hl7.org/fhir/ValueSet/restful-capability-mode); client | server**

 Identifies whether this portion of the statement is describing the ability to initiate or receive restful operations.

 */
    #[serde(rename = "mode")]
    pub mode: codes::RestfulCapabilityMode,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_mode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub mode_ext: Option<FieldExtension>,
    /** **General description of implementation**

 Information about the system's restful capabilities that apply across all applications, such as security.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "documentation")]
    pub documentation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_documentation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub documentation_ext: Option<FieldExtension>,
    /** **Information about security of implementation**

 Information about security implementation from an interface perspective - what a client needs to know.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "security")]
    pub security: Option<CapabilityStatementRestSecurity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_security")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub security_ext: Option<FieldExtension>,
    /** **Resource served on the REST interface**

 A specification of the restful capabilities of the solution for a specific resource type.

 Max of one repetition per resource type. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "resource")]
    pub resource: Vec<Option<CapabilityStatementRestResource>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_resource")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub resource_ext: Vec<Option<FieldExtension>>,
    /** **What operations are supported?**

 A specification of restful operations supported by the system.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "interaction")]
    pub interaction: Vec<Option<CapabilityStatementRestInteraction>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_interaction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub interaction_ext: Vec<Option<FieldExtension>>,
    /** **Search parameters for searching all resources**

 Search parameters that are supported for searching all resources for implementations to support and/or make use of - either references to ones defined in the specification, or additional ones defined for/by the implementation.

 Typically, the only search parameters supported for all searchse are those that apply to all resources - tags, profiles, text search etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "searchParam")]
    pub search_param: Vec<Option<CapabilityStatementRestResourceSearchParam>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_searchParam")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub search_param_ext: Vec<Option<FieldExtension>>,
    /** **Definition of an operation or a custom query**

 Definition of an operation or a named query together with its parameters and their meaning and type.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "operation")]
    pub operation: Vec<Option<CapabilityStatementRestOperation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_operation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub operation_ext: Vec<Option<FieldExtension>>,
    /** **Compartments served/used by system**

 An absolute URI which is a reference to the definition of a compartment that the system supports. The reference is to a CompartmentDefinition resource by its canonical URL .

 At present, the only defined compartments are at [CompartmentDefinition](compartmentdefinition.html). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "compartment")]
    pub compartment: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_compartment")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub compartment_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl CapabilityStatementRest {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CapabilityStatementRestBuilder {
        CapabilityStatementRestBuilder::default()
    }
}
/// Sub-fields of the security field in CapabilityStatementRest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CapabilityStatementRestSecurityBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CapabilityStatementRestSecurity {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Adds CORS Headers (http://enable-cors.org/)**

 Server adds CORS headers when responding to requests - this enables javascript applications to use the server.

 The easiest CORS headers to add are Access-Control-Allow-Origin: * & Access-Control-Request-Method: GET, POST, PUT, DELETE. All servers SHOULD support CORS. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "cors")]
    pub cors: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_cors")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub cors_ext: Option<FieldExtension>,
    /** **[RestfulSecurityService](http://hl7.org/fhir/ValueSet/restful-security-service); OAuth | SMART-on-FHIR | NTLM | Basic | Kerberos | Certificates**

 Types of security services that are supported/required by the system.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "service")]
    pub service: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_service")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub service_ext: Vec<Option<FieldExtension>>,
    /** **General description of how security works**

 General description of how security works.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Certificates associated with security profiles**

 Certificates associated with security profiles.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "certificate")]
    pub certificate: Vec<Option<CapabilityStatementRestSecurityCertificate>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_certificate")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub certificate_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl CapabilityStatementRestSecurity {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CapabilityStatementRestSecurityBuilder {
        CapabilityStatementRestSecurityBuilder::default()
    }
}
/// Sub-fields of the certificate field in CapabilityStatementRestSecurity
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CapabilityStatementRestSecurityCertificateBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CapabilityStatementRestSecurityCertificate {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[MimeType](http://www.rfc-editor.org/bcp/bcp13.txt); Mime type for certificates**

 Mime type for a certificate.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Actual certificate**

 Actual certificate.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "blob")]
    pub blob: Option<Base64Binary>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_blob")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub blob_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CapabilityStatementRestSecurityCertificate {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CapabilityStatementRestSecurityCertificateBuilder {
        CapabilityStatementRestSecurityCertificateBuilder::default()
    }
}
/// Sub-fields of the resource field in CapabilityStatementRest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CapabilityStatementRestResourceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CapabilityStatementRestResource {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ResourceType](http://hl7.org/fhir/ValueSet/resource-types); A resource type that is supported**

 A type of resource exposed via the restful interface.

 */
    #[serde(rename = "type")]
    pub r#type: codes::ResourceType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Base System profile for all uses of resource**

 A specification of the profile that describes the solution's overall support for the resource, including any constraints on cardinality, bindings, lengths or other limitations. See further discussion in [Using Profiles](profiling.html#profile-uses).

 The profile applies to all  resources of this type - i.e. it is the superset of what is supported by the system. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "profile")]
    pub profile: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_profile")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub profile_ext: Option<FieldExtension>,
    /** **Additional information about the use of the resource type**

 Additional information about the resource type used by the system.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "documentation")]
    pub documentation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_documentation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub documentation_ext: Option<FieldExtension>,
    /** **What operations are supported?**

 Identifies a restful operation supported by the solution.

 */
    #[serde(rename = "interaction")]
    pub interaction: Vec<Option<CapabilityStatementRestResourceInteraction>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_interaction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub interaction_ext: Vec<Option<FieldExtension>>,
    /** **[ResourceVersionPolicy](http://hl7.org/fhir/ValueSet/versioning-policy); no-version | versioned | versioned-update**

 This field is set to no-version to specify that the system does not support (server) or use (client) versioning for this resource type. If this has some other value, the server must at least correctly track and populate the versionId meta-property on resources. If the value is 'versioned-update', then the server supports all the versioning features, including using e-tags for version integrity in the API.

 If a server supports versionIds correctly, it SHOULD support vread too, but is not required to do so. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "versioning")]
    pub versioning: Option<codes::ResourceVersionPolicy>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_versioning")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub versioning_ext: Option<FieldExtension>,
    /** **Whether vRead can return past versions**

 A flag for whether the server is able to return past versions as part of the vRead operation.

 It is useful to support the vRead operation for current operations, even if past versions aren't available. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "readHistory")]
    pub read_history: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_readHistory")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub read_history_ext: Option<FieldExtension>,
    /** **If update can commit to a new identity**

 A flag to indicate that the server allows or needs to allow the client to create new identities on the server (e.g. that is, the client PUTs to a location where there is no existing resource). Allowing this operation means that the server allows the client to create new identities on the server.

 Allowing the clients to create new identities on the server means that the system administrator needs to have confidence that the clients do not create clashing identities between them. Obviously, if there is only one client, this won't happen. While creating identities on the client means that the clients need to be managed, it's much more convenient for many scenarios if such management can be put in place. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "updateCreate")]
    pub update_create: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_updateCreate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub update_create_ext: Option<FieldExtension>,
    /** **If allows/uses conditional create**

 A flag that indicates that the server supports conditional create.

 Conditional Create is mainly appropriate for interface engine scripts converting from other formats, such as v2. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "conditionalCreate")]
    pub conditional_create: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_conditionalCreate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub conditional_create_ext: Option<FieldExtension>,
    /** **[ConditionalReadStatus](http://hl7.org/fhir/ValueSet/conditional-read-status); not-supported | modified-since | not-match | full-support**

 A code that indicates how the server supports conditional read.

 Conditional Read is mainly appropriate for interface engine scripts converting from other formats, such as v2. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "conditionalRead")]
    pub conditional_read: Option<codes::ConditionalReadStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_conditionalRead")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub conditional_read_ext: Option<FieldExtension>,
    /** **If allows/uses conditional update**

 A flag that indicates that the server supports conditional update.

 Conditional Update is mainly appropriate for interface engine scripts converting from other formats, such as v2. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "conditionalUpdate")]
    pub conditional_update: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_conditionalUpdate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub conditional_update_ext: Option<FieldExtension>,
    /** **[ConditionalDeleteStatus](http://hl7.org/fhir/ValueSet/conditional-delete-status); not-supported | single | multiple - how conditional delete is supported**

 A code that indicates how the server supports conditional delete.

 Conditional Delete is mainly appropriate for interface engine scripts converting from other formats, such as v2. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "conditionalDelete")]
    pub conditional_delete: Option<codes::ConditionalDeleteStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_conditionalDelete")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub conditional_delete_ext: Option<FieldExtension>,
    /** **[ReferenceHandlingPolicy](http://hl7.org/fhir/ValueSet/reference-handling-policy); literal | logical | resolves | enforced | local**

 A set of flags that defines how references are supported.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "referencePolicy")]
    pub reference_policy: Vec<Option<codes::ReferenceHandlingPolicy>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_referencePolicy")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reference_policy_ext: Vec<Option<FieldExtension>>,
    /** **_include values supported by the server**

 A list of _include values supported by the server.

 If this list is empty, the server does not support includes. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "searchInclude")]
    pub search_include: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_searchInclude")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub search_include_ext: Vec<Option<FieldExtension>>,
    /** **_revinclude values supported by the server**

 A list of _revinclude (reverse include) values supported by the server.

 If this list is empty, the server does not support reverse includes. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "searchRevInclude")]
    pub search_rev_include: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_searchRevInclude")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub search_rev_include_ext: Vec<Option<FieldExtension>>,
    /** **Search parameters supported by implementation**

 Search parameters for implementations to support and/or make use of - either references to ones defined in the specification, or additional ones defined for/by the implementation.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "searchParam")]
    pub search_param: Vec<Option<CapabilityStatementRestResourceSearchParam>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_searchParam")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub search_param_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl CapabilityStatementRestResource {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CapabilityStatementRestResourceBuilder {
        CapabilityStatementRestResourceBuilder::default()
    }
}
/// Sub-fields of the interaction field in CapabilityStatementRestResource
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CapabilityStatementRestResourceInteractionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CapabilityStatementRestResourceInteraction {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[TypeRestfulInteraction](http://hl7.org/fhir/ValueSet/type-restful-interaction); read | vread | update | patch | delete | history-instance | history-type | create | search-type**

 Coded identifier of the operation, supported by the system resource.

 */
    #[serde(rename = "code")]
    pub code: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Anything special about operation behavior**

 Guidance specific to the implementation of this operation, such as 'delete is a logical delete' or 'updates are only allowed with version id' or 'creates permitted from pre-authorized certificates only'.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "documentation")]
    pub documentation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_documentation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub documentation_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CapabilityStatementRestResourceInteraction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CapabilityStatementRestResourceInteractionBuilder {
        CapabilityStatementRestResourceInteractionBuilder::default()
    }
}
/// Sub-fields of the searchParam field in CapabilityStatementRestResource
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CapabilityStatementRestResourceSearchParamBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CapabilityStatementRestResourceSearchParam {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Name of search parameter**

 The name of the search parameter used in the interface.

 Parameter names cannot overlap with standard parameter names, and standard parameters cannot be redefined. */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Source of definition for parameter**

 An absolute URI that is a formal reference to where this parameter was first defined, so that a client can be confident of the meaning of the search parameter (a reference to [SearchParameter.url]()).

 This SHOULD be present, and matches refers to a SearchParameter by its canonical url. If systems wish to document their support for modifiers, comparators, target resource types, and chained parameters, they should do using a search parameter resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definition")]
    pub definition: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_definition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub definition_ext: Option<FieldExtension>,
    /** **[SearchParamType](http://hl7.org/fhir/ValueSet/search-param-type); number | date | string | token | reference | composite | quantity | uri**

 The type of value a search parameter refers to, and how the content is interpreted.

 While this can be looked up from the definition, it is included here as a convenience for systems that autogenerate a query interface based on the server capability statement.  It SHALL be the same as the type in the search parameter definition. */
    #[serde(rename = "type")]
    pub r#type: codes::SearchParamType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Server-specific usage**

 This allows documentation of any distinct behaviors about how the search parameter is used.  For example, text matching algorithms.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "documentation")]
    pub documentation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_documentation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub documentation_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CapabilityStatementRestResourceSearchParam {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CapabilityStatementRestResourceSearchParamBuilder {
        CapabilityStatementRestResourceSearchParamBuilder::default()
    }
}
/// Sub-fields of the interaction field in CapabilityStatementRest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CapabilityStatementRestInteractionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CapabilityStatementRestInteraction {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[SystemRestfulInteraction](http://hl7.org/fhir/ValueSet/system-restful-interaction); transaction | batch | search-system | history-system**

 A coded identifier of the operation, supported by the system.

 */
    #[serde(rename = "code")]
    pub code: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Anything special about operation behavior**

 Guidance specific to the implementation of this operation, such as limitations on the kind of transactions allowed, or information about system wide search is implemented.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "documentation")]
    pub documentation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_documentation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub documentation_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CapabilityStatementRestInteraction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CapabilityStatementRestInteractionBuilder {
        CapabilityStatementRestInteractionBuilder::default()
    }
}
/// Sub-fields of the operation field in CapabilityStatementRest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CapabilityStatementRestOperationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CapabilityStatementRestOperation {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Name by which the operation/query is invoked**

 The name of the operation or query. For an operation, this is the name  prefixed with $ and used in the URL. For a query, this is the name used in the _query parameter when the query is called.

 The name here SHOULD be the same as the name in the definition, unless there is a name clash and the name cannot be used. The name does not include the "$" portion that is always included in the URL. */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **The defined operation/query**

 Where the formal definition can be found.

 This can be used to build an HTML form to invoke the operation, for instance. */
    #[serde(rename = "definition")]
    pub definition: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_definition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub definition_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CapabilityStatementRestOperation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CapabilityStatementRestOperationBuilder {
        CapabilityStatementRestOperationBuilder::default()
    }
}
/// Sub-fields of the messaging field in CapabilityStatement
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CapabilityStatementMessagingBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CapabilityStatementMessaging {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Where messages should be sent**

 An endpoint (network accessible address) to which messages and/or replies are to be sent.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endpoint")]
    pub endpoint: Vec<Option<CapabilityStatementMessagingEndpoint>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_endpoint")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub endpoint_ext: Vec<Option<FieldExtension>>,
    /** **Reliable Message Cache Length (min)**

 Length if the receiver's reliable messaging cache in minutes (if a receiver) or how long the cache length on the receiver should be (if a sender).

 If this value is missing then the application does not implement (receiver) or depend on (sender) reliable messaging. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reliableCache")]
    pub reliable_cache: Option<u32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reliableCache")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reliable_cache_ext: Option<FieldExtension>,
    /** **Messaging interface behavior details**

 Documentation about the system's messaging capabilities for this endpoint not otherwise documented by the capability statement.  For example, the process for becoming an authorized messaging exchange partner.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "documentation")]
    pub documentation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_documentation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub documentation_ext: Option<FieldExtension>,
    /** **Messages supported by this system**

 References to message definitions for messages this system can send or receive.

 This is a proposed alternative to the messaging.event structure. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "supportedMessage")]
    pub supported_message: Vec<Option<CapabilityStatementMessagingSupportedMessage>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_supportedMessage")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub supported_message_ext: Vec<Option<FieldExtension>>,
    /** **Declare support for this event**

 A description of the solution's support for an event at this end-point.

 The same event may be listed up to two times - once as sender and once as receiver. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "event")]
    pub event: Vec<Option<CapabilityStatementMessagingEvent>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_event")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub event_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl CapabilityStatementMessaging {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CapabilityStatementMessagingBuilder {
        CapabilityStatementMessagingBuilder::default()
    }
}
/// Sub-fields of the endpoint field in CapabilityStatementMessaging
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CapabilityStatementMessagingEndpointBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CapabilityStatementMessagingEndpoint {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[MessageTransport](http://hl7.org/fhir/ValueSet/message-transport); http | ftp | mllp +**

 A list of the messaging transport protocol(s) identifiers, supported by this endpoint.

 */
    #[serde(rename = "protocol")]
    pub protocol: Coding,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_protocol")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub protocol_ext: Option<FieldExtension>,
    /** **Network address or identifier of the end-point**

 The network address of the end-point. For solutions that do not use network addresses for routing, it can be just an identifier.

 */
    #[serde(rename = "address")]
    pub address: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_address")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub address_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CapabilityStatementMessagingEndpoint {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CapabilityStatementMessagingEndpointBuilder {
        CapabilityStatementMessagingEndpointBuilder::default()
    }
}
/// Sub-fields of the supportedMessage field in CapabilityStatementMessaging
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CapabilityStatementMessagingSupportedMessageBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CapabilityStatementMessagingSupportedMessage {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[EventCapabilityMode](http://hl7.org/fhir/ValueSet/event-capability-mode); sender | receiver**

 The mode of this event declaration - whether application is sender or receiver.

 */
    #[serde(rename = "mode")]
    pub mode: codes::EventCapabilityMode,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_mode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub mode_ext: Option<FieldExtension>,
    /** **Message supported by this system**

 Points to a message definition that identifies the messaging event, message structure, allowed responses, etc.

 */
    #[serde(rename = "definition")]
    pub definition: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_definition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub definition_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CapabilityStatementMessagingSupportedMessage {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CapabilityStatementMessagingSupportedMessageBuilder {
        CapabilityStatementMessagingSupportedMessageBuilder::default()
    }
}
/// Sub-fields of the event field in CapabilityStatementMessaging
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CapabilityStatementMessagingEventBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CapabilityStatementMessagingEvent {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[MessageEvent](http://hl7.org/fhir/ValueSet/message-events); Event type**

 A coded identifier of a supported messaging event.

 */
    #[serde(rename = "code")]
    pub code: Coding,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **[MessageSignificanceCategory](http://hl7.org/fhir/ValueSet/message-significance-category); Consequence | Currency | Notification**

 The impact of the content of the message.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<codes::MessageSignificanceCategory>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[EventCapabilityMode](http://hl7.org/fhir/ValueSet/event-capability-mode); sender | receiver**

 The mode of this event declaration - whether an application is a sender or receiver.

 */
    #[serde(rename = "mode")]
    pub mode: codes::EventCapabilityMode,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_mode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub mode_ext: Option<FieldExtension>,
    /** **[ResourceType](http://hl7.org/fhir/ValueSet/resource-types); Resource that's focus of message**

 A resource associated with the event.  This is the resource that defines the event.

 This SHALL be provided if the event type supports multiple different resource types. */
    #[serde(rename = "focus")]
    pub focus: codes::ResourceType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_focus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub focus_ext: Option<FieldExtension>,
    /** **Profile that describes the request**

 Information about the request for this event.

 */
    #[serde(rename = "request")]
    pub request: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_request")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_ext: Option<FieldExtension>,
    /** **Profile that describes the response**

 Information about the response for this event.

 */
    #[serde(rename = "response")]
    pub response: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_response")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub response_ext: Option<FieldExtension>,
    /** **Endpoint-specific event documentation**

 Guidance on how this event is handled, such as internal system trigger points, business rules, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "documentation")]
    pub documentation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_documentation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub documentation_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CapabilityStatementMessagingEvent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CapabilityStatementMessagingEventBuilder {
        CapabilityStatementMessagingEventBuilder::default()
    }
}
/// Sub-fields of the document field in CapabilityStatement
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CapabilityStatementDocumentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CapabilityStatementDocument {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DocumentMode](http://hl7.org/fhir/ValueSet/document-mode); producer | consumer**

 Mode of this document declaration - whether an application is a producer or consumer.

 */
    #[serde(rename = "mode")]
    pub mode: codes::DocumentMode,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_mode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub mode_ext: Option<FieldExtension>,
    /** **Description of document support**

 A description of how the application supports or uses the specified document profile.  For example, when documents are created, what action is taken with consumed documents, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "documentation")]
    pub documentation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_documentation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub documentation_ext: Option<FieldExtension>,
    /** **Constraint on a resource used in the document**

 A constraint on a resource used in the document.

 The first resource is the document resource. */
    #[serde(rename = "profile")]
    pub profile: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_profile")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub profile_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CapabilityStatementDocument {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CapabilityStatementDocumentBuilder {
        CapabilityStatementDocumentBuilder::default()
    }
}
/** Base StructureDefinition for CarePlan Resource

 **[CarePlan](http://hl7.org/fhir/StructureDefinition/CarePlan) v3.0.2**

 Healthcare plan for patient or group

 Describes the intention of how one or more practitioners intend to deliver care for a particular patient, group or community for a period of time, possibly limited to care for a specific condition or set of conditions.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct CarePlan(pub Box<CarePlanInner>);
/** Base StructureDefinition for CarePlan Resource

 **[CarePlan](http://hl7.org/fhir/StructureDefinition/CarePlan) v3.0.2**

 Healthcare plan for patient or group

 Describes the intention of how one or more practitioners intend to deliver care for a particular patient, group or community for a period of time, possibly limited to care for a specific condition or set of conditions.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CarePlanBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct CarePlanInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "CarePlan::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::CarePlan", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **External Ids for this plan**

 This records identifiers associated with this care plan that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Protocol or definition**

 Identifies the protocol, questionnaire, guideline or other specification the care plan should be conducted in accordance with.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definition")]
    pub definition: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_definition")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub definition_ext: Vec<Option<FieldExtension>>,
    /** **Fulfills care plan**

 A care plan that is fulfilled in whole or in part by this care plan.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basedOn")]
    pub based_on: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_basedOn")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub based_on_ext: Vec<Option<FieldExtension>>,
    /** **CarePlan replaced by this CarePlan**

 Completed or terminated care plan whose function is taken by this new care plan.

 The replacement could be because the initial care plan was immediately rejected (due to an issue) or because the previous care plan was completed, but the need for the action described by the care plan remains ongoing. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "replaces")]
    pub replaces: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_replaces")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub replaces_ext: Vec<Option<FieldExtension>>,
    /** **Part of referenced CarePlan**

 A larger care plan of which this particular care plan is a component or step.

 Each care plan is an independent request, such that having a care plan be part of another care plan can cause issues with cascading statuses.  As such, this element is still being discussed. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "partOf")]
    pub part_of: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_partOf")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub part_of_ext: Vec<Option<FieldExtension>>,
    /** **[CarePlanStatus](http://hl7.org/fhir/ValueSet/care-plan-status); draft | active | suspended | completed | entered-in-error | cancelled | unknown**

 Indicates whether the plan is currently being acted upon, represents future intentions or is now a historical record.

 The unknown code is not to be used to convey other statuses.  The unknown code should be used when one of the statuses applies, but the authoring system doesn't know the current state of the care plan.

This element is labeled as a modifier because the status contains the code entered-in-error] that marks the plan as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::CarePlanStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[CarePlanIntent](http://hl7.org/fhir/ValueSet/care-plan-intent); proposal | plan | order | option**

 Indicates the level of authority/intentionality associated with the care plan and where the care plan fits into the workflow chain.

 This element is labeled as a modifier because the intent alters when and how the resource is actually applicable. */
    #[serde(rename = "intent")]
    pub intent: codes::CarePlanIntent,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_intent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub intent_ext: Option<FieldExtension>,
    /** **[CarePlanCategory](http://hl7.org/fhir/ValueSet/care-plan-category); Type of plan**

 Identifies what "kind" of plan this is to support differentiation between multiple co-existing plans; e.g. "Home health", "psychiatric", "asthma", "disease management", "wellness plan", etc.

 There may be multiple axis of categorization and one plan may serve multiple purposes.  In some cases, this may be redundant with references to CarePlan.concern. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub category_ext: Vec<Option<FieldExtension>>,
    /** **Human-friendly name for the CarePlan**

 Human-friendly name for the CarePlan.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **Summary of nature of plan**

 A description of the scope and nature of the plan.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Who care plan is for**

 Identifies the patient or group whose intended care is described by the plan.

 */
    #[serde(rename = "subject")]
    pub subject: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Created in context of**

 Identifies the original context in which this particular CarePlan was created.

 Activities conducted as a result of the care plan may well occur as part of other encounters/episodes. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **Time period plan covers**

 Indicates when the plan did (or is intended to) come into effect and end.

 Any activities scheduled as part of the plan should be constrained to the specified period regardless of whether the activities are planned within a single encounter/episode or across multiple encounters/episodes (e.g. the longitudinal management of a chronic condition). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
    /** **Who is responsible for contents of the plan**

 Identifies the individual(s) or ogranization who is responsible for the content of the care plan.

 Collaborative care plans may have multiple authors. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_author")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub author_ext: Vec<Option<FieldExtension>>,
    /** **Who's involved in plan?**

 Identifies all people and organizations who are expected to be involved in the care envisioned by this plan.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "careTeam")]
    pub care_team: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_careTeam")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub care_team_ext: Vec<Option<FieldExtension>>,
    /** **Health issues this plan addresses**

 Identifies the conditions/problems/concerns/diagnoses/etc. whose management and/or mitigation are handled by this plan.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "addresses")]
    pub addresses: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_addresses")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub addresses_ext: Vec<Option<FieldExtension>>,
    /** **Information considered as part of plan**

 Identifies portions of the patient's record that specifically influenced the formation of the plan.  These might include co-morbidities, recent procedures, limitations, recent assessments, etc.

 Use "concern" to identify specific conditions addressed by the care plan. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "supportingInfo")]
    pub supporting_info: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_supportingInfo")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub supporting_info_ext: Vec<Option<FieldExtension>>,
    /** **Desired outcome of plan**

 Describes the intended objective(s) of carrying out the care plan.

 Goal can be achieving a particular change or merely maintaining a current state or even slowing a decline. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "goal")]
    pub goal: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_goal")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub goal_ext: Vec<Option<FieldExtension>>,
    /** **Action to occur as part of plan**

 Identifies a planned action to occur as part of the plan.  For example, a medication to be used, lab tests to perform, self-monitoring, education, etc.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "activity")]
    pub activity: Vec<Option<CarePlanActivity>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_activity")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub activity_ext: Vec<Option<FieldExtension>>,
    /** **Comments about the plan**

 General notes about the care plan not covered elsewhere.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl CarePlanBuilder {
    #[doc = concat!("Finalize building ", "CarePlan", ".")]
    pub fn build(self) -> Result<CarePlan, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<CarePlanInner> for CarePlan {
    fn from(inner: CarePlanInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for CarePlan {
    type Target = CarePlanInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for CarePlan {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl CarePlan {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> CarePlanBuilder {
        CarePlanBuilder::default()
    }
}
impl CarePlan {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::CarePlan
    }
}
/// Sub-fields of the activity field in CarePlan
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CarePlanActivityBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CarePlanActivity {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[CarePlanActivityOutcome](http://hl7.org/fhir/ValueSet/care-plan-activity-outcome); Results of the activity**

 Identifies the outcome at the point when the status of the activity is assessed.  For example, the outcome of an education activity could be patient understands (or not).

 Note that this should not duplicate the activity status (e.g. completed or in progress). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "outcomeCodeableConcept")]
    pub outcome_codeable_concept: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_outcomeCodeableConcept")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub outcome_codeable_concept_ext: Vec<Option<FieldExtension>>,
    /** **Appointment, Encounter, Procedure, etc.**

 Details of the outcome or action resulting from the activity.  The reference to an "event" resource, such as Procedure or Encounter or Observation, is the result/outcome of the activity itself.  The activity can be conveyed using CarePlan.activity.detail OR using the CarePlan.activity.reference (a reference to a “request” resource).

 The activity outcome is independent of the outcome of the related goal(s).  For example, if the goal is to achieve a target body weight of 150 lb and an activity is defined to diet, then the activity outcome could be calories consumed whereas the goal outcome is an observation for the actual body weight measured. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "outcomeReference")]
    pub outcome_reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_outcomeReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub outcome_reference_ext: Vec<Option<FieldExtension>>,
    /** **Comments about the activity status/progress**

 Notes about the adherence/status/progress of the activity.

 This element should NOT be used to describe the activity to be performed - that occurs either within the resource pointed to by activity.detail.reference or in activity.detail.description. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "progress")]
    pub progress: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_progress")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub progress_ext: Vec<Option<FieldExtension>>,
    /** **Activity details defined in specific resource**

 The details of the proposed activity represented in a specific resource.

 Standard extension exists ([goal-pertainstogoal](extension-goal-pertainstogoal.html)) that allows goals to be referenced from any of the referenced resources in CarePlan.activity.reference.
The goal should be visible when the resource referenced by CarePlan.activity.reference is viewed indepedently from the CarePlan.  Requests that are pointed to by a CarePlan using this element should *not* point to this CarePlan using the "basedOn" element.  i.e. Requests that are part of a CarePlan are not "based on" the CarePlan. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reference")]
    pub reference: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reference_ext: Option<FieldExtension>,
    /** **In-line definition of activity**

 A simple summary of a planned activity suitable for a general care plan system (e.g. form driven) that doesn't know about specific resources such as procedure etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "detail")]
    pub detail: Option<CarePlanActivityDetail>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_detail")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub detail_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CarePlanActivity {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CarePlanActivityBuilder {
        CarePlanActivityBuilder::default()
    }
}
/// Sub-fields of the detail field in CarePlanActivity
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CarePlanActivityDetailBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CarePlanActivityDetail {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[CarePlanActivityCategory](http://hl7.org/fhir/ValueSet/care-plan-activity-category); diet | drug | encounter | observation | procedure | supply | other**

 High-level categorization of the type of activity in a care plan.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **Protocol or definition**

 Identifies the protocol, questionnaire, guideline or other specification the planned activity should be conducted in accordance with.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definition")]
    pub definition: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_definition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub definition_ext: Option<FieldExtension>,
    /** **[CarePlanActivityType](http://hl7.org/fhir/ValueSet/care-plan-activity); Detail type of activity**

 Detailed description of the type of planned activity; e.g. What lab test, what procedure, what kind of encounter.

 Tends to be less relevant for activities involving particular products.  Codes should not convey negation - use "prohibited" instead. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **[CarePlanActivityReason](http://hl7.org/fhir/ValueSet/activity-reason); Why activity should be done or why activity was prohibited**

 Provides the rationale that drove the inclusion of this particular activity as part of the plan or the reason why the activity was prohibited.

 This could be a diagnosis code.  If a full condition record exists or additional detail is needed, use reasonCondition instead. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonCode")]
    pub reason_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_code_ext: Vec<Option<FieldExtension>>,
    /** **Condition triggering need for activity**

 Provides the health condition(s) that drove the inclusion of this particular activity as part of the plan.

 Conditions can be identified at the activity level that are not identified as reasons for the overall plan. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonReference")]
    pub reason_reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_reference_ext: Vec<Option<FieldExtension>>,
    /** **Goals this activity relates to**

 Internal reference that identifies the goals that this activity is intended to contribute towards meeting.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "goal")]
    pub goal: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_goal")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub goal_ext: Vec<Option<FieldExtension>>,
    /** **[CarePlanActivityStatus](http://hl7.org/fhir/ValueSet/care-plan-activity-status); not-started | scheduled | in-progress | on-hold | completed | cancelled | unknown**

 Identifies what progress is being made for the specific activity.

 Some aspects of status can be inferred based on the resources linked in actionTaken.  Note that "status" is only as current as the plan was most recently updated.
The unknown code is not to be used to convey other statuses.  The unknown code should be used when one of the statuses applies, but the authoring system doesn't know the current state of the activity. */
    #[serde(rename = "status")]
    pub status: codes::CarePlanActivityStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **Reason for current status**

 Provides reason why the activity isn't yet started, is on hold, was cancelled, etc.

 Will generally not be present if status is "complete".  Be sure to prompt to update this (or at least remove the existing value) if the status is changed. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "statusReason")]
    pub status_reason: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_statusReason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_reason_ext: Option<FieldExtension>,
    /** **Do NOT do**

 If true, indicates that the described activity is one that must NOT be engaged in when following the plan.  If false, indicates that the described activity is one that should be engaged in when following the plan.

 This element is labeled as a modifier because it marks an activity as an activity that is not to be performed. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "prohibited")]
    pub prohibited: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_prohibited")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub prohibited_ext: Option<FieldExtension>,
    /** **When activity is to occur**

 The period, timing or frequency upon which the described activity is to occur.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub scheduled: Option<CarePlanActivityDetailScheduled>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub scheduled_ext: Option<CarePlanActivityDetailScheduledExtension>,
    /** **Where it should happen**

 Identifies the facility where the activity will occur; e.g. home, hospital, specific clinic, etc.

 May reference a specific clinical location or may identify a type of location. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "location")]
    pub location: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_location")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub location_ext: Option<FieldExtension>,
    /** **Who will be responsible?**

 Identifies who's expected to be involved in the activity.

 A performer MAY also be a participant in the care plan. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_performer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub performer_ext: Vec<Option<FieldExtension>>,
    /** **What is to be administered/supplied**

 Identifies the food, drug or other product to be consumed or supplied in the activity.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub product: Option<CarePlanActivityDetailProduct>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_ext: Option<CarePlanActivityDetailProductExtension>,
    /** **How to consume/day?**

 Identifies the quantity expected to be consumed in a given day.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dailyAmount")]
    pub daily_amount: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_dailyAmount")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub daily_amount_ext: Option<FieldExtension>,
    /** **How much to administer/supply/consume**

 Identifies the quantity expected to be supplied, administered or consumed by the subject.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_quantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<FieldExtension>,
    /** **Extra info describing activity to perform**

 This provides a textual description of constraints on the intended activity occurrence, including relation to other activities.  It may also include objectives, pre-conditions and end-conditions.  Finally, it may convey specifics about the activity such as body site, method, route, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CarePlanActivityDetail {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CarePlanActivityDetailBuilder {
        CarePlanActivityDetailBuilder::default()
    }
}
/// Choice of types for the scheduled[x] field in CarePlanActivityDetail
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CarePlanActivityDetailScheduled {
    /// Variant accepting the Timing type.
    #[serde(rename = "scheduledTiming")]
    Timing(Timing),
    /// Variant accepting the Period type.
    #[serde(rename = "scheduledPeriod")]
    Period(Period),
    /// Variant accepting the String type.
    #[serde(rename = "scheduledString")]
    String(String),
}
/// Extension value for CarePlanActivityDetailScheduled.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CarePlanActivityDetailScheduledExtension {
    /// Variant accepting the Timing extension.
    #[serde(rename = "_scheduledTiming")]
    Timing(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_scheduledPeriod")]
    Period(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_scheduledString")]
    String(FieldExtension),
}
/// Choice of types for the product[x] field in CarePlanActivityDetail
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CarePlanActivityDetailProduct {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "productCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "productReference")]
    Reference(Reference),
}
/// Extension value for CarePlanActivityDetailProduct.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CarePlanActivityDetailProductExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_productCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_productReference")]
    Reference(FieldExtension),
}
/** Base StructureDefinition for CareTeam Resource

 **[CareTeam](http://hl7.org/fhir/StructureDefinition/CareTeam) v3.0.2**

 Planned participants in the coordination and delivery of care for a patient or group

 The Care Team includes all the people and organizations who plan to participate in the coordination and delivery of care for a patient.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct CareTeam(pub Box<CareTeamInner>);
/** Base StructureDefinition for CareTeam Resource

 **[CareTeam](http://hl7.org/fhir/StructureDefinition/CareTeam) v3.0.2**

 Planned participants in the coordination and delivery of care for a patient or group

 The Care Team includes all the people and organizations who plan to participate in the coordination and delivery of care for a patient.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CareTeamBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct CareTeamInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "CareTeam::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::CareTeam", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **External Ids for this team**

 This records identifiers associated with this care team that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[CareTeamStatus](http://hl7.org/fhir/ValueSet/care-team-status); proposed | active | suspended | inactive | entered-in-error**

 Indicates the current state of the care team.

 This element is labeled as a modifier because the status contains the code entered-in-error that marks the care team as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<codes::CareTeamStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[CareTeamCategory](http://hl7.org/fhir/ValueSet/care-team-category); Type of team**

 Identifies what kind of team.  This is to support differentiation between multiple co-existing teams, such as care plan team, episode of care team, longitudinal care team.

 There may be multiple axis of categorization and one team may serve multiple purposes. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub category_ext: Vec<Option<FieldExtension>>,
    /** **Name of the team, such as crisis assessment team**

 A label for human use intended to distinguish like teams.  E.g. the "red" vs. "green" trauma teams.

 The meaning/purpose of the team is conveyed in CareTeam.category.  This element may also convey semantics of the team (e.g. "Red trauma team"), but its primary purpose is to distinguish between identical teams in a human-friendly way.  ("Team 18735" isn't as friendly . ). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Who care team is for**

 Identifies the patient or group whose intended care is handled by the team.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Encounter or episode associated with CareTeam**

 The encounter or episode of care that establishes the context for this care team.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **Time period team covers**

 Indicates when the team did (or is intended to) come into effect and end.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
    /** **Members of the team**

 Identifies all people and organizations who are expected to be involved in the care team.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "participant")]
    pub participant: Vec<Option<CareTeamParticipant>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_participant")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub participant_ext: Vec<Option<FieldExtension>>,
    /** **[CareTeamReason](http://hl7.org/fhir/ValueSet/clinical-findings); Why the care team exists**

 Describes why the care team exists.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonCode")]
    pub reason_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_code_ext: Vec<Option<FieldExtension>>,
    /** **Why the care team exists**

 Condition(s) that this care team addresses.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonReference")]
    pub reason_reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_reference_ext: Vec<Option<FieldExtension>>,
    /** **Organization responsible for the care team**

 The organization responsible for the care team.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "managingOrganization")]
    pub managing_organization: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_managingOrganization")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub managing_organization_ext: Vec<Option<FieldExtension>>,
    /** **Comments made about the CareTeam**

 Comments made about the CareTeam.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl CareTeamBuilder {
    #[doc = concat!("Finalize building ", "CareTeam", ".")]
    pub fn build(self) -> Result<CareTeam, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<CareTeamInner> for CareTeam {
    fn from(inner: CareTeamInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for CareTeam {
    type Target = CareTeamInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for CareTeam {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl CareTeam {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> CareTeamBuilder {
        CareTeamBuilder::default()
    }
}
impl CareTeam {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::CareTeam
    }
}
/// Sub-fields of the participant field in CareTeam
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CareTeamParticipantBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CareTeamParticipant {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[CareTeamParticipantRole](http://hl7.org/fhir/ValueSet/participant-role); Type of involvement**

 Indicates specific responsibility of an individual within the care team, such as "Primary care physician", "Trained social worker counselor", "Caregiver", etc.

 Roles may sometimes be inferred by type of Practitioner.  These are relationships that hold only within the context of the care team.  General relationships should be handled as properties of the Patient resource directly. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "role")]
    pub role: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_role")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub role_ext: Option<FieldExtension>,
    /** **Who is involved**

 The specific person or organization who is participating/expected to participate in the care team.

 Patient only needs to be listed if they have a role other than "subject of care".

Member is optional because some participants may be known only by their role, particularly in draft plans. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "member")]
    pub member: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_member")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub member_ext: Option<FieldExtension>,
    /** **Organization of the practitioner**

 The organization of the practitioner.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "onBehalfOf")]
    pub on_behalf_of: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_onBehalfOf")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub on_behalf_of_ext: Option<FieldExtension>,
    /** **Time period of participant**

 Indicates when the specific member or organization did (or is intended to) come into effect and end.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CareTeamParticipant {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CareTeamParticipantBuilder {
        CareTeamParticipantBuilder::default()
    }
}
/** Base StructureDefinition for ChargeItem Resource

 **[ChargeItem](http://hl7.org/fhir/StructureDefinition/ChargeItem) v3.0.2**

 Item containing charge code(s) associated with the provision of healthcare provider products

 The resource ChargeItem describes the provision of healthcare provider products for a certain patient, therefore referring not only to the product, but containing in addition details of the provision, like date, time, amounts and participating organizations and persons. Main Usage of the ChargeItem is to enable the billing process and internal cost allocation.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ChargeItem(pub Box<ChargeItemInner>);
/** Base StructureDefinition for ChargeItem Resource

 **[ChargeItem](http://hl7.org/fhir/StructureDefinition/ChargeItem) v3.0.2**

 Item containing charge code(s) associated with the provision of healthcare provider products

 The resource ChargeItem describes the provision of healthcare provider products for a certain patient, therefore referring not only to the product, but containing in addition details of the provision, like date, time, amounts and participating organizations and persons. Main Usage of the ChargeItem is to enable the billing process and internal cost allocation.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ChargeItemBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ChargeItemInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ChargeItem::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ChargeItem", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business Identifier for item**

 Identifiers assigned to this event performer or other systems.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **Defining information about the code of this charge item**

 References the source of pricing information, rules of application for the code this ChargeItem uses.

 Target Resource is yet to be defined as a container that holds information about list prices and rules applicable to the charge item code. Once defined, change type back to Reference(Definition Type). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definition")]
    pub definition: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_definition")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub definition_ext: Vec<Option<FieldExtension>>,
    /** **[ChargeItemStatus](http://hl7.org/fhir/ValueSet/chargeitem-status); planned | billable | not-billable | aborted | billed | entered-in-error | unknown**

 The current state of the ChargeItem.

 Unknown does not represent "other" - one of the defined statuses must apply.  Unknown is used when the authoring system is not sure what the current status is.

This element is labeled as a modifier because the status contains the code entered-in-error that marks the charge item as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::ChargeItemStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **Part of referenced ChargeItem**

 ChargeItems can be grouped to larger ChargeItems covering the whole set.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "partOf")]
    pub part_of: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_partOf")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub part_of_ext: Vec<Option<FieldExtension>>,
    /** **[ChargeItemCode](http://hl7.org/fhir/ValueSet/chargeitem-billingcodes); A code that identifies the charge, like a billing code**

 A code that identifies the charge, like a billing code.

 */
    #[serde(rename = "code")]
    pub code: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Individual service was done for/to**

 The individual or set of individuals the action is being or was performed on.

 */
    #[serde(rename = "subject")]
    pub subject: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Encounter / Episode associated with event**

 The encounter or episode of care that establishes the context for this event.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **When the charged service was applied**

 Date/time(s) or duration when the charged service was applied.

 The list of types may be constrained as appropriate for the type of charge item. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub occurrence: Option<ChargeItemOccurrence>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub occurrence_ext: Option<ChargeItemOccurrenceExtension>,
    /** **Who performed charged service**

 Indicates who or what performed or participated in the charged service.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "participant")]
    pub participant: Vec<Option<ChargeItemParticipant>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_participant")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub participant_ext: Vec<Option<FieldExtension>>,
    /** **Organization providing the charged sevice**

 The organization requesting the service.

 Practitioners and Devices can be associated with multiple organizations. It has to be made clear, on behalf of which Organization the services have been rendered. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performingOrganization")]
    pub performing_organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_performingOrganization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub performing_organization_ext: Option<FieldExtension>,
    /** **Organization requesting the charged service**

 The organization performing the service.

 The rendered Service may not be associated with a Request. It has to be made clear, ob which Organization's Request, the services have been rendered. (In many cases, this may just be the Department associated with the Encounter.location). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requestingOrganization")]
    pub requesting_organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requestingOrganization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub requesting_organization_ext: Option<FieldExtension>,
    /** **Quantity of which the charge item has been serviced**

 Quantity of which the charge item has been serviced.

 In many cases this may just be a value, if the underlying units are implicit in the definition of the charge item code. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_quantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<FieldExtension>,
    /** **[BodySite](http://hl7.org/fhir/ValueSet/body-site); Anatomical location, if relevant**

 The anatomical location where the related service has been applied.

 Only used if not implicit in code found in Condition.code. If the use case requires attributes from the BodySite resource (e.g. to identify and track separately) then use the standard extension [body-site-instance](extension-body-site-instance.html).  May be a summary code, or a reference to a very precise definition of the location, or both. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "bodysite")]
    pub bodysite: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_bodysite")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub bodysite_ext: Vec<Option<FieldExtension>>,
    /** **Factor overriding the associated rules**

 Factor overriding the factor determined by the rules associated with the code.

 There is no reason to carry the factor in the instance of a ChargeItem unless special circumstances require a manual override. The factors are usually defined by a set of rules in a back catalogue of the billing codes  (see ChargeItem.definition). Derived profiles may require a ChargeItem.overrideReason to be provided if either factor or price are manually overriden. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "factorOverride")]
    pub factor_override: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_factorOverride")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub factor_override_ext: Option<FieldExtension>,
    /** **Price overriding the associated rules**

 Total price of the charge overriding the list price associated with the code.

 There is no reason to carry the price in the instance of a ChargeItem unless circumstances require a manual override. The list prices or are usually defined in a back catalogue of the billing codes  (see ChargeItem.definition). Derived profiles may require a ChargeItem.overrideReason to be provided if either factor or price are manually overriden. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "priceOverride")]
    pub price_override: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_priceOverride")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub price_override_ext: Option<FieldExtension>,
    /** **Reason for overriding the list price/factor**

 If the list price or the rule based factor associated with the code is overridden, this attribute can capture a text to indicate the  reason for this action.

 Derived Profiles may chose to add invariants requiring this field to be populated if either priceOverride or factorOverride have been filled. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "overrideReason")]
    pub override_reason: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_overrideReason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub override_reason_ext: Option<FieldExtension>,
    /** **Individual who was entering**

 The device, practitioner, etc. who entered the charge item.

 The enterer is also te person considered responsible for factor/priceOverrides if applicable. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "enterer")]
    pub enterer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_enterer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub enterer_ext: Option<FieldExtension>,
    /** **Date the charge item was entered**

 Date the charge item was entered.

 The actual date when the service associated with the charge has been rendered is captured in occurrence[x]. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "enteredDate")]
    pub entered_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_enteredDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub entered_date_ext: Option<FieldExtension>,
    /** **[ChargeItemReason](http://hl7.org/fhir/ValueSet/icd-10); Why was the charged  service rendered?**

 Describes why the event occurred in coded or textual form.

 If the application of the charge item requires a reason to be given, it can be captured here. Textual reasons can be captured using reasonCode.text. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reason")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_ext: Vec<Option<FieldExtension>>,
    /** **Which rendered service is being charged?**

 Indicated the rendered service that caused this charge.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "service")]
    pub service: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_service")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub service_ext: Vec<Option<FieldExtension>>,
    /** **Account to place this charge**

 Account into which this ChargeItems belongs.

 Systems posting the ChargeItems may not always be able to determine, which accounts the Items need to be places into. It is up to the potprocessing Financial System to apply internal rules to decide based on the Encounter/EpisodeOfCare/Patient/Coverage context and the type of ChargeItem, which Account is appropriate. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "account")]
    pub account: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_account")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub account_ext: Vec<Option<FieldExtension>>,
    /** **Comments made about the ChargeItem**

 Comments made about the event by the performer, subject or other participants.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
    /** **Further information supporting the this charge**

 Further information supporting the this charge.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "supportingInformation")]
    pub supporting_information: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_supportingInformation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub supporting_information_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ChargeItemBuilder {
    #[doc = concat!("Finalize building ", "ChargeItem", ".")]
    pub fn build(self) -> Result<ChargeItem, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ChargeItemInner> for ChargeItem {
    fn from(inner: ChargeItemInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ChargeItem {
    type Target = ChargeItemInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ChargeItem {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ChargeItem {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ChargeItemBuilder {
        ChargeItemBuilder::default()
    }
}
impl ChargeItem {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ChargeItem
    }
}
/// Choice of types for the occurrence[x] field in ChargeItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ChargeItemOccurrence {
    /// Variant accepting the DateTime type.
    #[serde(rename = "occurrenceDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "occurrencePeriod")]
    Period(Period),
    /// Variant accepting the Timing type.
    #[serde(rename = "occurrenceTiming")]
    Timing(Timing),
}
/// Extension value for ChargeItemOccurrence.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ChargeItemOccurrenceExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_occurrenceDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_occurrencePeriod")]
    Period(FieldExtension),
    /// Variant accepting the Timing extension.
    #[serde(rename = "_occurrenceTiming")]
    Timing(FieldExtension),
}
/// Sub-fields of the participant field in ChargeItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ChargeItemParticipantBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ChargeItemParticipant {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ChargeItemPerformerRole](http://hl7.org/fhir/ValueSet/performer-role); What type of performance was done**

 Describes the type of performance or participation(e.g. primary surgeon, anaesthesiologiest, etc.).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "role")]
    pub role: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_role")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub role_ext: Option<FieldExtension>,
    /** **Individual who was performing**

 The device, practitioner, etc. who performed or participated in the service.

 */
    #[serde(rename = "actor")]
    pub actor: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_actor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub actor_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ChargeItemParticipant {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ChargeItemParticipantBuilder {
        ChargeItemParticipantBuilder::default()
    }
}
/** Base StructureDefinition for Claim Resource

 **[Claim](http://hl7.org/fhir/StructureDefinition/Claim) v3.0.2**

 Claim, Pre-determination or Pre-authorization

 A provider issued list of services and products provided, or to be provided, to a patient which is provided to an insurer for payment recovery.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Claim(pub Box<ClaimInner>);
/** Base StructureDefinition for Claim Resource

 **[Claim](http://hl7.org/fhir/StructureDefinition/Claim) v3.0.2**

 Claim, Pre-determination or Pre-authorization

 A provider issued list of services and products provided, or to be provided, to a patient which is provided to an insurer for payment recovery.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ClaimInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Claim::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Claim", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Claim number**

 The business identifier for the instance: claim number, pre-determination or pre-authorization number.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[ClaimStatus](http://hl7.org/fhir/ValueSet/fm-status); active | cancelled | draft | entered-in-error**

 The status of the resource instance.

 This element is labeled as a modifier because the status contains the code entered-in-error that marks the claim as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[ClaimType](http://hl7.org/fhir/ValueSet/claim-type); Type or discipline**

 The category of claim, eg, oral, pharmacy, vision, insitutional, professional.

 Affects which fields and value sets are used. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[ClaimSubType](http://hl7.org/fhir/ValueSet/claim-subtype); Finer grained claim type information**

 A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the BillType.

 This may contain the local bill type codes such as the US UB-04 bill type code. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subType")]
    pub sub_type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub sub_type_ext: Vec<Option<FieldExtension>>,
    /** **[Use](http://hl7.org/fhir/ValueSet/claim-use); complete | proposed | exploratory | other**

 Complete (Bill or Claim), Proposed (Pre-Authorization), Exploratory (Pre-determination).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "use")]
    pub r#use: Option<codes::Use>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_use")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#use_ext: Option<FieldExtension>,
    /** **The subject of the Products and Services**

 Patient Resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patient")]
    pub patient: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_ext: Option<FieldExtension>,
    /** **Period for charge submission**

 The billable period for which charges are being submitted.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "billablePeriod")]
    pub billable_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_billablePeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub billable_period_ext: Option<FieldExtension>,
    /** **Creation date**

 The date when the enclosed suite of services were performed or completed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "created")]
    pub created: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_created")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub created_ext: Option<FieldExtension>,
    /** **Author**

 Person who created the invoice/claim/pre-determination or pre-authorization.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "enterer")]
    pub enterer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_enterer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub enterer_ext: Option<FieldExtension>,
    /** **Target**

 The Insurer who is target of the request.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "insurer")]
    pub insurer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_insurer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub insurer_ext: Option<FieldExtension>,
    /** **Responsible provider**

 The provider which is responsible for the bill, claim pre-determination, pre-authorization.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "provider")]
    pub provider: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_provider")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub provider_ext: Option<FieldExtension>,
    /** **Responsible organization**

 The organization which is responsible for the bill, claim pre-determination, pre-authorization.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "organization")]
    pub organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_organization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub organization_ext: Option<FieldExtension>,
    /** **[ProcessPriority](http://hl7.org/fhir/ValueSet/process-priority); Desired processing priority**

 Immediate (STAT), best effort (NORMAL), deferred (DEFER).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "priority")]
    pub priority: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_priority")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub priority_ext: Option<FieldExtension>,
    /** **[FundsReserve](http://hl7.org/fhir/ValueSet/fundsreserve); Funds requested to be reserved**

 In the case of a Pre-Determination/Pre-Authorization the provider may request that funds in the amount of the expected Benefit be reserved ('Patient' or 'Provider') to pay for the Benefits determined on the subsequent claim(s). 'None' explicitly indicates no funds reserving is requested.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "fundsReserve")]
    pub funds_reserve: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_fundsReserve")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub funds_reserve_ext: Option<FieldExtension>,
    /** **Related Claims which may be revelant to processing this claimn**

 Other claims which are related to this claim such as prior claim versions or for related services.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "related")]
    pub related: Vec<Option<ClaimRelated>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_related")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub related_ext: Vec<Option<FieldExtension>>,
    /** **Prescription authorizing services or products**

 Prescription to support the dispensing of Pharmacy or Vision products.

 Should we create a group to hold multiple prescriptions and add a sequence number and on the line items a link to the sequence. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "prescription")]
    pub prescription: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_prescription")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub prescription_ext: Option<FieldExtension>,
    /** **Original prescription if superceded by fulfiller**

 Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products. For example, a physician may prescribe a medication which the pharmacy determines is contraindicated, or for which the patient has an intolerance, and therefor issues a new precription for an alternate medication which has the same theraputic intent. The prescription from the pharmacy becomes the 'prescription' and that from the physician becomes the 'original prescription'.

 as above. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "originalPrescription")]
    pub original_prescription: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_originalPrescription")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub original_prescription_ext: Option<FieldExtension>,
    /** **Party to be paid any benefits payable**

 The party to be reimbursed for the services.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "payee")]
    pub payee: Option<ClaimPayee>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_payee")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub payee_ext: Option<FieldExtension>,
    /** **Treatment Referral**

 The referral resource which lists the date, practitioner, reason and other supporting information.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "referral")]
    pub referral: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_referral")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub referral_ext: Option<FieldExtension>,
    /** **Servicing Facility**

 Facility where the services were provided.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "facility")]
    pub facility: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_facility")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub facility_ext: Option<FieldExtension>,
    /** **Members of the care team**

 The members of the team who provided the overall service as well as their role and whether responsible and qualifications.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "careTeam")]
    pub care_team: Vec<Option<ClaimCareTeam>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_careTeam")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub care_team_ext: Vec<Option<FieldExtension>>,
    /** **Exceptions, special considerations, the condition, situation, prior or concurrent issues**

 Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues. Often there are mutiple jurisdiction specific valuesets which are required.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "information")]
    pub information: Vec<Option<ClaimInformation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_information")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub information_ext: Vec<Option<FieldExtension>>,
    /** **List of Diagnosis**

 List of patient diagnosis for which care is sought.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "diagnosis")]
    pub diagnosis: Vec<Option<ClaimDiagnosis>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_diagnosis")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub diagnosis_ext: Vec<Option<FieldExtension>>,
    /** **Procedures performed**

 Ordered list of patient procedures performed to support the adjudication.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "procedure")]
    pub procedure: Vec<Option<ClaimProcedure>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_procedure")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub procedure_ext: Vec<Option<FieldExtension>>,
    /** **Insurance or medical plan**

 Financial instrument by which payment information for health care.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "insurance")]
    pub insurance: Vec<Option<ClaimInsurance>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_insurance")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub insurance_ext: Vec<Option<FieldExtension>>,
    /** **Details about an accident**

 An accident which resulted in the need for healthcare services.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "accident")]
    pub accident: Option<ClaimAccident>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_accident")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub accident_ext: Option<FieldExtension>,
    /** **Period unable to work**

 The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "employmentImpacted")]
    pub employment_impacted: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_employmentImpacted")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub employment_impacted_ext: Option<FieldExtension>,
    /** **Period in hospital**

 The start and optional end dates of when the patient was confined to a treatment center.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "hospitalization")]
    pub hospitalization: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_hospitalization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub hospitalization_ext: Option<FieldExtension>,
    /** **Goods and Services**

 First tier of goods and services.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "item")]
    pub item: Vec<Option<ClaimItem>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_item")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub item_ext: Vec<Option<FieldExtension>>,
    /** **Total claim cost**

 The total value of the claim.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "total")]
    pub total: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_total")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub total_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ClaimBuilder {
    #[doc = concat!("Finalize building ", "Claim", ".")]
    pub fn build(self) -> Result<Claim, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ClaimInner> for Claim {
    fn from(inner: ClaimInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Claim {
    type Target = ClaimInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Claim {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Claim {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ClaimBuilder {
        ClaimBuilder::default()
    }
}
impl Claim {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Claim
    }
}
/// Sub-fields of the related field in Claim
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimRelatedBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimRelated {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Reference to the related claim**

 Other claims which are related to this claim such as prior claim versions or for related services.

 Do we need a relationship code? */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "claim")]
    pub claim: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_claim")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub claim_ext: Option<FieldExtension>,
    /** **[RelatedClaimRelationship](http://hl7.org/fhir/ValueSet/related-claim-relationship); How the reference claim is related**

 For example prior or umbrella.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relationship")]
    pub relationship: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_relationship")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub relationship_ext: Option<FieldExtension>,
    /** **Related file or case reference**

 An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # .

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reference")]
    pub reference: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reference_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ClaimRelated {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimRelatedBuilder {
        ClaimRelatedBuilder::default()
    }
}
/// Sub-fields of the payee field in Claim
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimPayeeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimPayee {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[PayeeType](http://hl7.org/fhir/ValueSet/payeetype); Type of party: Subscriber, Provider, other**

 Type of Party to be reimbursed: Subscriber, provider, other.

 */
    #[serde(rename = "type")]
    pub r#type: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[ClaimPayeeResourceType](http://hl7.org/fhir/ValueSet/ex-payee-resource-type); organization | patient | practitioner | relatedperson**

 organization | patient | practitioner | relatedperson.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "resourceType")]
    pub resource_type: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_resourceType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub resource_type_ext: Option<FieldExtension>,
    /** **Party to receive the payable**

 Party to be reimbursed: Subscriber, provider, other.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "party")]
    pub party: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_party")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub party_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ClaimPayee {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimPayeeBuilder {
        ClaimPayeeBuilder::default()
    }
}
/// Sub-fields of the careTeam field in Claim
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimCareTeamBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimCareTeam {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Number to covey order of careTeam**

 Sequence of the careTeam which serves to order and provide a link.

 */
    #[serde(rename = "sequence")]
    pub sequence: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_ext: Option<FieldExtension>,
    /** **Provider individual or organization**

 Member of the team who provided the overall service.

 */
    #[serde(rename = "provider")]
    pub provider: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_provider")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub provider_ext: Option<FieldExtension>,
    /** **Billing provider**

 The party who is billing and responsible for the claimed good or service rendered to the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "responsible")]
    pub responsible: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_responsible")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub responsible_ext: Option<FieldExtension>,
    /** **[CareTeamRole](http://hl7.org/fhir/ValueSet/claim-careteamrole); Role on the team**

 The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "role")]
    pub role: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_role")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub role_ext: Option<FieldExtension>,
    /** **[ProviderQualification](http://hl7.org/fhir/ValueSet/provider-qualification); Type, classification or Specialization**

 The qualification which is applicable for this service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "qualification")]
    pub qualification: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_qualification")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub qualification_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ClaimCareTeam {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimCareTeamBuilder {
        ClaimCareTeamBuilder::default()
    }
}
/// Sub-fields of the information field in Claim
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimInformationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimInformation {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Information instance identifier**

 Sequence of the information element which serves to provide a link.

 */
    #[serde(rename = "sequence")]
    pub sequence: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_ext: Option<FieldExtension>,
    /** **[InformationCategory](http://hl7.org/fhir/ValueSet/claim-informationcategory); General class of information**

 The general class of the information supplied: information; exception; accident, employment; onset, etc.

 This may contain the local bill type codes such as the US UB-04 bill type code. */
    #[serde(rename = "category")]
    pub category: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[InformationCode](http://hl7.org/fhir/ValueSet/claim-exception); Type of information**

 System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought which may influence the adjudication.

 This may contain the local bill type codes such as the US UB-04 bill type code. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **When it occurred**

 The date when or period to which this information refers.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub timing: Option<ClaimInformationTiming>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub timing_ext: Option<ClaimInformationTimingExtension>,
    /** **Additional Data or supporting information**

 Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<ClaimInformationValue>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<ClaimInformationValueExtension>,
    /** **[MissingReason](http://hl7.org/fhir/ValueSet/missing-tooth-reason); Reason associated with the information**

 For example, provides the reason for: the additional stay, or missing tooth or any other situation where a reason code is required in addition to the content.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reason_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ClaimInformation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimInformationBuilder {
        ClaimInformationBuilder::default()
    }
}
/// Choice of types for the timing[x] field in ClaimInformation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimInformationTiming {
    /// Variant accepting the Date type.
    #[serde(rename = "timingDate")]
    Date(Date),
    /// Variant accepting the Period type.
    #[serde(rename = "timingPeriod")]
    Period(Period),
}
/// Extension value for ClaimInformationTiming.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimInformationTimingExtension {
    /// Variant accepting the Date extension.
    #[serde(rename = "_timingDate")]
    Date(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_timingPeriod")]
    Period(FieldExtension),
}
/// Choice of types for the value[x] field in ClaimInformation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimInformationValue {
    /// Variant accepting the String type.
    #[serde(rename = "valueString")]
    String(String),
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Attachment type.
    #[serde(rename = "valueAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Reference type.
    #[serde(rename = "valueReference")]
    Reference(Reference),
}
/// Extension value for ClaimInformationValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimInformationValueExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_valueString")]
    String(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_valueAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_valueReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the diagnosis field in Claim
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimDiagnosisBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimDiagnosis {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Number to covey order of diagnosis**

 Sequence of diagnosis which serves to provide a link.

 */
    #[serde(rename = "sequence")]
    pub sequence: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_ext: Option<FieldExtension>,
    /** **Patient's diagnosis**

 The diagnosis.

 */
    #[serde(flatten)]
    pub diagnosis: ClaimDiagnosisDiagnosis,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub diagnosis_ext: Option<ClaimDiagnosisDiagnosisExtension>,
    /** **[DiagnosisType](http://hl7.org/fhir/ValueSet/ex-diagnosistype); Timing or nature of the diagnosis**

 The type of the Diagnosis, for example: admitting, primary, secondary, discharge.

 Diagnosis are presented in list order to their expected importance: primary, secondary, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub r#type_ext: Vec<Option<FieldExtension>>,
    /** **[DiagnosisRelatedGroup](http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup); Package billing code**

 The package billing code, for example DRG, based on the assigned grouping code system.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "packageCode")]
    pub package_code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_packageCode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub package_code_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ClaimDiagnosis {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimDiagnosisBuilder {
        ClaimDiagnosisBuilder::default()
    }
}
/// Choice of types for the diagnosis[x] field in ClaimDiagnosis
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimDiagnosisDiagnosis {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "diagnosisCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "diagnosisReference")]
    Reference(Reference),
}
/// Extension value for ClaimDiagnosisDiagnosis.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimDiagnosisDiagnosisExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_diagnosisCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_diagnosisReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the procedure field in Claim
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimProcedureBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimProcedure {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Procedure sequence for reference**

 Sequence of procedures which serves to order and provide a link.

 */
    #[serde(rename = "sequence")]
    pub sequence: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_ext: Option<FieldExtension>,
    /** **When the procedure was performed**

 Date and optionally time the procedure was performed .

 SB DateTime?? */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Patient's list of procedures performed**

 The procedure code.

 */
    #[serde(flatten)]
    pub procedure: ClaimProcedureProcedure,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub procedure_ext: Option<ClaimProcedureProcedureExtension>,
}
#[cfg(feature = "builders")]
impl ClaimProcedure {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimProcedureBuilder {
        ClaimProcedureBuilder::default()
    }
}
/// Choice of types for the procedure[x] field in ClaimProcedure
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimProcedureProcedure {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "procedureCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "procedureReference")]
    Reference(Reference),
}
/// Extension value for ClaimProcedureProcedure.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimProcedureProcedureExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_procedureCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_procedureReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the insurance field in Claim
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimInsuranceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimInsurance {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Service instance identifier**

 Sequence of coverage which serves to provide a link and convey coordination of benefit order.

 */
    #[serde(rename = "sequence")]
    pub sequence: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_ext: Option<FieldExtension>,
    /** **Is the focal Coverage**

 A flag to indicate that this Coverage is the focus for adjudication. The Coverage against which the claim is to be adjudicated.

 */
    #[serde(rename = "focal")]
    pub focal: bool,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_focal")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub focal_ext: Option<FieldExtension>,
    /** **Insurance information**

 Reference to the program or plan identification, underwriter or payor.

 */
    #[serde(rename = "coverage")]
    pub coverage: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_coverage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub coverage_ext: Option<FieldExtension>,
    /** **Business agreement**

 The contract number of a business agreement which describes the terms and conditions.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "businessArrangement")]
    pub business_arrangement: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_businessArrangement")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub business_arrangement_ext: Option<FieldExtension>,
    /** **Pre-Authorization/Determination Reference**

 A list of references from the Insurer to which these services pertain.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "preAuthRef")]
    pub pre_auth_ref: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_preAuthRef")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub pre_auth_ref_ext: Vec<Option<FieldExtension>>,
    /** **Adjudication results**

 The Coverages adjudication details.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "claimResponse")]
    pub claim_response: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_claimResponse")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub claim_response_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ClaimInsurance {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimInsuranceBuilder {
        ClaimInsuranceBuilder::default()
    }
}
/// Sub-fields of the accident field in Claim
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimAccidentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimAccident {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **When the accident occurred
see information codes
see information codes**

 Date of an accident which these services are addressing.

 */
    #[serde(rename = "date")]
    pub date: Date,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **[AccidentType](http://hl7.org/fhir/ValueSet/v3-ActIncidentCode); The nature of the accident**

 Type of accident: work, auto, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Accident Place**

 Accident Place.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub location: Option<ClaimAccidentLocation>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub location_ext: Option<ClaimAccidentLocationExtension>,
}
#[cfg(feature = "builders")]
impl ClaimAccident {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimAccidentBuilder {
        ClaimAccidentBuilder::default()
    }
}
/// Choice of types for the location[x] field in ClaimAccident
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimAccidentLocation {
    /// Variant accepting the Address type.
    #[serde(rename = "locationAddress")]
    Address(Address),
    /// Variant accepting the Reference type.
    #[serde(rename = "locationReference")]
    Reference(Reference),
}
/// Extension value for ClaimAccidentLocation.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimAccidentLocationExtension {
    /// Variant accepting the Address extension.
    #[serde(rename = "_locationAddress")]
    Address(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_locationReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the item field in Claim
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimItemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimItem {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Service instance**

 A service line number.

 */
    #[serde(rename = "sequence")]
    pub sequence: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_ext: Option<FieldExtension>,
    /** **Applicable careTeam members**

 CareTeam applicable for this service or product line.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "careTeamLinkId")]
    pub care_team_link_id: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_careTeamLinkId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub care_team_link_id_ext: Vec<Option<FieldExtension>>,
    /** **Applicable diagnoses**

 Diagnosis applicable for this service or product line.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "diagnosisLinkId")]
    pub diagnosis_link_id: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_diagnosisLinkId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub diagnosis_link_id_ext: Vec<Option<FieldExtension>>,
    /** **Applicable procedures**

 Procedures applicable for this service or product line.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "procedureLinkId")]
    pub procedure_link_id: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_procedureLinkId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub procedure_link_id_ext: Vec<Option<FieldExtension>>,
    /** **Applicable exception and supporting information**

 Exceptions, special conditions and supporting information pplicable for this service or product line.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "informationLinkId")]
    pub information_link_id: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_informationLinkId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub information_link_id_ext: Vec<Option<FieldExtension>>,
    /** **[RevenueCenter](http://hl7.org/fhir/ValueSet/ex-revenue-center); Revenue or cost center code**

 The type of reveneu or cost center providing the product and/or service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "revenue")]
    pub revenue: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_revenue")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub revenue_ext: Option<FieldExtension>,
    /** **[BenefitSubCategory](http://hl7.org/fhir/ValueSet/benefit-subcategory); Type of service or product**

 Health Care Service Type Codes  to identify the classification of service or benefits.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); Billing Code**

 If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,RXNorm,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "service")]
    pub service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_service")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub service_ext: Option<FieldExtension>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Service/Product billing modifiers**

 Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifier")]
    pub modifier: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_modifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub modifier_ext: Vec<Option<FieldExtension>>,
    /** **[ProgramCode](http://hl7.org/fhir/ValueSet/ex-program-code); Program specific reason for item inclusion**

 For programs which require reason codes for the inclusion or covering of this billed item under the program or sub-program.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "programCode")]
    pub program_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_programCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub program_code_ext: Vec<Option<FieldExtension>>,
    /** **Date or dates of Service**

 The date or dates when the enclosed suite of services were performed or completed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub serviced: Option<ClaimItemServiced>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub serviced_ext: Option<ClaimItemServicedExtension>,
    /** **Place of service**

 Where the service was provided.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub location: Option<ClaimItemLocation>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub location_ext: Option<ClaimItemLocationExtension>,
    /** **Count of Products or Services**

 The number of repetitions of a service or product.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_quantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<FieldExtension>,
    /** **Fee, charge or cost per point**

 If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "unitPrice")]
    pub unit_price: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_unitPrice")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub unit_price_ext: Option<FieldExtension>,
    /** **Price scaling factor**

 A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "factor")]
    pub factor: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_factor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub factor_ext: Option<FieldExtension>,
    /** **Total item cost**

 The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "net")]
    pub net: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_net")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub net_ext: Option<FieldExtension>,
    /** **Unique Device Identifier**

 List of Unique Device Identifiers associated with this line item.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "udi")]
    pub udi: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_udi")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub udi_ext: Vec<Option<FieldExtension>>,
    /** **[OralSites](http://hl7.org/fhir/ValueSet/tooth); Service Location**

 Physical service site on the patient (limb, tooth, etc).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "bodySite")]
    pub body_site: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_bodySite")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub body_site_ext: Option<FieldExtension>,
    /** **[Surface](http://hl7.org/fhir/ValueSet/surface); Service Sub-location**

 A region or surface of the site, eg. limb region or tooth surface(s).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subSite")]
    pub sub_site: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subSite")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub sub_site_ext: Vec<Option<FieldExtension>>,
    /** **Encounters related to this billed item**

 A billed item may include goods or services provided in multiple encounters.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "encounter")]
    pub encounter: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_encounter")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub encounter_ext: Vec<Option<FieldExtension>>,
    /** **Additional items**

 Second tier of goods and services.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "detail")]
    pub detail: Vec<Option<ClaimItemDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_detail")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub detail_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ClaimItem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimItemBuilder {
        ClaimItemBuilder::default()
    }
}
/// Choice of types for the serviced[x] field in ClaimItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimItemServiced {
    /// Variant accepting the Date type.
    #[serde(rename = "servicedDate")]
    Date(Date),
    /// Variant accepting the Period type.
    #[serde(rename = "servicedPeriod")]
    Period(Period),
}
/// Extension value for ClaimItemServiced.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimItemServicedExtension {
    /// Variant accepting the Date extension.
    #[serde(rename = "_servicedDate")]
    Date(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_servicedPeriod")]
    Period(FieldExtension),
}
/// Choice of types for the location[x] field in ClaimItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimItemLocation {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "locationCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Address type.
    #[serde(rename = "locationAddress")]
    Address(Address),
    /// Variant accepting the Reference type.
    #[serde(rename = "locationReference")]
    Reference(Reference),
}
/// Extension value for ClaimItemLocation.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClaimItemLocationExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_locationCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Address extension.
    #[serde(rename = "_locationAddress")]
    Address(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_locationReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the detail field in ClaimItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimItemDetailBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimItemDetail {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Service instance**

 A service line number.

 */
    #[serde(rename = "sequence")]
    pub sequence: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_ext: Option<FieldExtension>,
    /** **[RevenueCenter](http://hl7.org/fhir/ValueSet/ex-revenue-center); Revenue or cost center code**

 The type of reveneu or cost center providing the product and/or service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "revenue")]
    pub revenue: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_revenue")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub revenue_ext: Option<FieldExtension>,
    /** **[BenefitSubCategory](http://hl7.org/fhir/ValueSet/benefit-subcategory); Type of service or product**

 Health Care Service Type Codes  to identify the classification of service or benefits.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); Billing Code**

 If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "service")]
    pub service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_service")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub service_ext: Option<FieldExtension>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Service/Product billing modifiers**

 Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifier")]
    pub modifier: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_modifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub modifier_ext: Vec<Option<FieldExtension>>,
    /** **[ProgramCode](http://hl7.org/fhir/ValueSet/ex-program-code); Program specific reason for item inclusion**

 For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "programCode")]
    pub program_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_programCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub program_code_ext: Vec<Option<FieldExtension>>,
    /** **Count of Products or Services**

 The number of repetitions of a service or product.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_quantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<FieldExtension>,
    /** **Fee, charge or cost per point**

 If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "unitPrice")]
    pub unit_price: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_unitPrice")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub unit_price_ext: Option<FieldExtension>,
    /** **Price scaling factor**

 A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "factor")]
    pub factor: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_factor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub factor_ext: Option<FieldExtension>,
    /** **Total additional item cost**

 The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "net")]
    pub net: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_net")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub net_ext: Option<FieldExtension>,
    /** **Unique Device Identifier**

 List of Unique Device Identifiers associated with this line item.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "udi")]
    pub udi: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_udi")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub udi_ext: Vec<Option<FieldExtension>>,
    /** **Additional items**

 Third tier of goods and services.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subDetail")]
    pub sub_detail: Vec<Option<ClaimItemDetailSubDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subDetail")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub sub_detail_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ClaimItemDetail {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimItemDetailBuilder {
        ClaimItemDetailBuilder::default()
    }
}
/// Sub-fields of the subDetail field in ClaimItemDetail
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimItemDetailSubDetailBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimItemDetailSubDetail {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Service instance**

 A service line number.

 */
    #[serde(rename = "sequence")]
    pub sequence: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_ext: Option<FieldExtension>,
    /** **[RevenueCenter](http://hl7.org/fhir/ValueSet/ex-revenue-center); Revenue or cost center code**

 The type of reveneu or cost center providing the product and/or service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "revenue")]
    pub revenue: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_revenue")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub revenue_ext: Option<FieldExtension>,
    /** **[BenefitSubCategory](http://hl7.org/fhir/ValueSet/benefit-subcategory); Type of service or product**

 Health Care Service Type Codes  to identify the classification of service or benefits.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); Billing Code**

 A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "service")]
    pub service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_service")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub service_ext: Option<FieldExtension>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Service/Product billing modifiers**

 Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifier")]
    pub modifier: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_modifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub modifier_ext: Vec<Option<FieldExtension>>,
    /** **[ProgramCode](http://hl7.org/fhir/ValueSet/ex-program-code); Program specific reason for item inclusion**

 For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "programCode")]
    pub program_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_programCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub program_code_ext: Vec<Option<FieldExtension>>,
    /** **Count of Products or Services**

 The number of repetitions of a service or product.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_quantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<FieldExtension>,
    /** **Fee, charge or cost per point**

 The fee for an addittional service or product or charge.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "unitPrice")]
    pub unit_price: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_unitPrice")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub unit_price_ext: Option<FieldExtension>,
    /** **Price scaling factor**

 A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "factor")]
    pub factor: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_factor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub factor_ext: Option<FieldExtension>,
    /** **Net additional item cost**

 The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "net")]
    pub net: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_net")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub net_ext: Option<FieldExtension>,
    /** **Unique Device Identifier**

 List of Unique Device Identifiers associated with this line item.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "udi")]
    pub udi: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_udi")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub udi_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ClaimItemDetailSubDetail {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimItemDetailSubDetailBuilder {
        ClaimItemDetailSubDetailBuilder::default()
    }
}
/** Base StructureDefinition for ClaimResponse Resource

 **[ClaimResponse](http://hl7.org/fhir/StructureDefinition/ClaimResponse) v3.0.2**

 Remittance resource

 This resource provides the adjudication details from the processing of a Claim resource.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ClaimResponse(pub Box<ClaimResponseInner>);
/** Base StructureDefinition for ClaimResponse Resource

 **[ClaimResponse](http://hl7.org/fhir/StructureDefinition/ClaimResponse) v3.0.2**

 Remittance resource

 This resource provides the adjudication details from the processing of a Claim resource.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimResponseBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ClaimResponseInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ClaimResponse::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ClaimResponse", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Response  number**

 The Response business identifier.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[ClaimResponseStatus](http://hl7.org/fhir/ValueSet/fm-status); active | cancelled | draft | entered-in-error**

 The status of the resource instance.

 This element is labeled as a modifier because the status contains the code cancelled and entered-in-error that mark the response as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **The subject of the Products and Services**

 Patient Resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patient")]
    pub patient: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_ext: Option<FieldExtension>,
    /** **Creation date**

 The date when the enclosed suite of services were performed or completed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "created")]
    pub created: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_created")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub created_ext: Option<FieldExtension>,
    /** **Insurance issuing organization**

 The Insurer who produced this adjudicated response.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "insurer")]
    pub insurer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_insurer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub insurer_ext: Option<FieldExtension>,
    /** **Responsible practitioner**

 The practitioner who is responsible for the services rendered to the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requestProvider")]
    pub request_provider: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requestProvider")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_provider_ext: Option<FieldExtension>,
    /** **Responsible organization**

 The organization which is responsible for the services rendered to the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requestOrganization")]
    pub request_organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requestOrganization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_organization_ext: Option<FieldExtension>,
    /** **Id of resource triggering adjudication**

 Original request resource referrence.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "request")]
    pub request: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_request")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_ext: Option<FieldExtension>,
    /** **[RemittanceOutcome](http://hl7.org/fhir/ValueSet/remittance-outcome); complete | error | partial**

 Processing outcome errror, partial or complete processing.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "outcome")]
    pub outcome: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_outcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub outcome_ext: Option<FieldExtension>,
    /** **Disposition Message**

 A description of the status of the adjudication.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "disposition")]
    pub disposition: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_disposition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub disposition_ext: Option<FieldExtension>,
    /** **[PayeeType](http://hl7.org/fhir/ValueSet/payeetype); Party to be paid any benefits payable**

 Party to be reimbursed: Subscriber, provider, other.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "payeeType")]
    pub payee_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_payeeType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub payee_type_ext: Option<FieldExtension>,
    /** **Line items**

 The first tier service adjudications for submitted services.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "item")]
    pub item: Vec<Option<ClaimResponseItem>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_item")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub item_ext: Vec<Option<FieldExtension>>,
    /** **Insurer added line items**

 The first tier service adjudications for payor added services.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "addItem")]
    pub add_item: Vec<Option<ClaimResponseAddItem>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_addItem")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub add_item_ext: Vec<Option<FieldExtension>>,
    /** **Processing errors**

 Mutually exclusive with Services Provided (Item).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "error")]
    pub error: Vec<Option<ClaimResponseError>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_error")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub error_ext: Vec<Option<FieldExtension>>,
    /** **Total Cost of service from the Claim**

 The total cost of the services reported.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "totalCost")]
    pub total_cost: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_totalCost")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub total_cost_ext: Option<FieldExtension>,
    /** **Unallocated deductible**

 The amount of deductible applied which was not allocated to any particular service line.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "unallocDeductable")]
    pub unalloc_deductable: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_unallocDeductable")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub unalloc_deductable_ext: Option<FieldExtension>,
    /** **Total benefit payable for the Claim**

 Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductible).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "totalBenefit")]
    pub total_benefit: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_totalBenefit")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub total_benefit_ext: Option<FieldExtension>,
    /** **Payment details, if paid**

 Payment details for the claim if the claim has been paid.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "payment")]
    pub payment: Option<ClaimResponsePayment>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_payment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub payment_ext: Option<FieldExtension>,
    /** **[FundsReserve](http://hl7.org/fhir/ValueSet/fundsreserve); Funds reserved status**

 Status of funds reservation (For provider, for Patient, None).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reserved")]
    pub reserved: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reserved")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reserved_ext: Option<FieldExtension>,
    /** **[Forms](http://hl7.org/fhir/ValueSet/forms); Printed Form Identifier**

 The form to be used for printing the content.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "form")]
    pub form: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_form")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub form_ext: Option<FieldExtension>,
    /** **Processing notes**

 Note text.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "processNote")]
    pub process_note: Vec<Option<ClaimResponseProcessNote>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_processNote")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub process_note_ext: Vec<Option<FieldExtension>>,
    /** **Request for additional information**

 Request for additional supporting or authorizing information, such as: documents, images or resources.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "communicationRequest")]
    pub communication_request: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_communicationRequest")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub communication_request_ext: Vec<Option<FieldExtension>>,
    /** **Insurance or medical plan**

 Financial instrument by which payment information for health care.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "insurance")]
    pub insurance: Vec<Option<ClaimResponseInsurance>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_insurance")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub insurance_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ClaimResponseBuilder {
    #[doc = concat!("Finalize building ", "ClaimResponse", ".")]
    pub fn build(self) -> Result<ClaimResponse, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ClaimResponseInner> for ClaimResponse {
    fn from(inner: ClaimResponseInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ClaimResponse {
    type Target = ClaimResponseInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ClaimResponse {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ClaimResponse {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ClaimResponseBuilder {
        ClaimResponseBuilder::default()
    }
}
impl ClaimResponse {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ClaimResponse
    }
}
/// Sub-fields of the item field in ClaimResponse
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimResponseItemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimResponseItem {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Service instance**

 A service line number.

 */
    #[serde(rename = "sequenceLinkId")]
    pub sequence_link_id: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequenceLinkId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_link_id_ext: Option<FieldExtension>,
    /** **List of note numbers which apply**

 A list of note references to the notes provided below.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "noteNumber")]
    pub note_number: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_noteNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_number_ext: Vec<Option<FieldExtension>>,
    /** **Adjudication details**

 The adjudication results.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "adjudication")]
    pub adjudication: Vec<Option<ClaimResponseItemAdjudication>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_adjudication")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub adjudication_ext: Vec<Option<FieldExtension>>,
    /** **Detail line items**

 The second tier service adjudications for submitted services.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "detail")]
    pub detail: Vec<Option<ClaimResponseItemDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_detail")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub detail_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ClaimResponseItem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimResponseItemBuilder {
        ClaimResponseItemBuilder::default()
    }
}
/// Sub-fields of the adjudication field in ClaimResponseItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimResponseItemAdjudicationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimResponseItemAdjudication {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[Adjudication](http://hl7.org/fhir/ValueSet/adjudication); Adjudication category such as co-pay, eligible, benefit, etc.**

 Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.

 */
    #[serde(rename = "category")]
    pub category: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[AdjudicationReason](http://hl7.org/fhir/ValueSet/adjudication-reason); Explanation of Adjudication outcome**

 Adjudication reason such as limit reached.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reason_ext: Option<FieldExtension>,
    /** **Monetary amount**

 Monetary amount associated with the code.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "amount")]
    pub amount: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_amount")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub amount_ext: Option<FieldExtension>,
    /** **Non-monetary value**

 A non-monetary value for example a percentage. Mutually exclusive to the amount element above.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "value")]
    pub value: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_value")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ClaimResponseItemAdjudication {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimResponseItemAdjudicationBuilder {
        ClaimResponseItemAdjudicationBuilder::default()
    }
}
/// Sub-fields of the detail field in ClaimResponseItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimResponseItemDetailBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimResponseItemDetail {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Service instance**

 A service line number.

 */
    #[serde(rename = "sequenceLinkId")]
    pub sequence_link_id: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequenceLinkId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_link_id_ext: Option<FieldExtension>,
    /** **List of note numbers which apply**

 A list of note references to the notes provided below.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "noteNumber")]
    pub note_number: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_noteNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_number_ext: Vec<Option<FieldExtension>>,
    /** **Detail level adjudication details**

 The adjudications results.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "adjudication")]
    pub adjudication: Vec<Option<ClaimResponseItemAdjudication>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_adjudication")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub adjudication_ext: Vec<Option<FieldExtension>>,
    /** **Subdetail line items**

 The third tier service adjudications for submitted services.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subDetail")]
    pub sub_detail: Vec<Option<ClaimResponseItemDetailSubDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subDetail")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub sub_detail_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ClaimResponseItemDetail {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimResponseItemDetailBuilder {
        ClaimResponseItemDetailBuilder::default()
    }
}
/// Sub-fields of the subDetail field in ClaimResponseItemDetail
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimResponseItemDetailSubDetailBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimResponseItemDetailSubDetail {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Service instance**

 A service line number.

 */
    #[serde(rename = "sequenceLinkId")]
    pub sequence_link_id: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequenceLinkId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_link_id_ext: Option<FieldExtension>,
    /** **List of note numbers which apply**

 A list of note references to the notes provided below.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "noteNumber")]
    pub note_number: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_noteNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_number_ext: Vec<Option<FieldExtension>>,
    /** **Subdetail level adjudication details**

 The adjudications results.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "adjudication")]
    pub adjudication: Vec<Option<ClaimResponseItemAdjudication>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_adjudication")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub adjudication_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ClaimResponseItemDetailSubDetail {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimResponseItemDetailSubDetailBuilder {
        ClaimResponseItemDetailSubDetailBuilder::default()
    }
}
/// Sub-fields of the addItem field in ClaimResponse
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimResponseAddItemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimResponseAddItem {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Service instances**

 List of input service items which this service line is intended to replace.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sequenceLinkId")]
    pub sequence_link_id: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_sequenceLinkId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub sequence_link_id_ext: Vec<Option<FieldExtension>>,
    /** **[RevenueCenter](http://hl7.org/fhir/ValueSet/ex-revenue-center); Revenue or cost center code**

 The type of reveneu or cost center providing the product and/or service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "revenue")]
    pub revenue: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_revenue")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub revenue_ext: Option<FieldExtension>,
    /** **[BenefitSubCategory](http://hl7.org/fhir/ValueSet/benefit-subcategory); Type of service or product**

 Health Care Service Type Codes  to identify the classification of service or benefits.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); Group, Service or Product**

 A code to indicate the Professional Service or Product supplied.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "service")]
    pub service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_service")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub service_ext: Option<FieldExtension>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Service/Product billing modifiers**

 Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifier")]
    pub modifier: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_modifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub modifier_ext: Vec<Option<FieldExtension>>,
    /** **Professional fee or Product charge**

 The fee charged for the professional service or product..

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "fee")]
    pub fee: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_fee")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub fee_ext: Option<FieldExtension>,
    /** **List of note numbers which apply**

 A list of note references to the notes provided below.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "noteNumber")]
    pub note_number: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_noteNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_number_ext: Vec<Option<FieldExtension>>,
    /** **Added items adjudication**

 The adjudications results.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "adjudication")]
    pub adjudication: Vec<Option<ClaimResponseItemAdjudication>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_adjudication")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub adjudication_ext: Vec<Option<FieldExtension>>,
    /** **Added items details**

 The second tier service adjudications for payor added services.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "detail")]
    pub detail: Vec<Option<ClaimResponseAddItemDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_detail")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub detail_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ClaimResponseAddItem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimResponseAddItemBuilder {
        ClaimResponseAddItemBuilder::default()
    }
}
/// Sub-fields of the detail field in ClaimResponseAddItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimResponseAddItemDetailBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimResponseAddItemDetail {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[RevenueCenter](http://hl7.org/fhir/ValueSet/ex-revenue-center); Revenue or cost center code**

 The type of reveneu or cost center providing the product and/or service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "revenue")]
    pub revenue: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_revenue")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub revenue_ext: Option<FieldExtension>,
    /** **[BenefitSubCategory](http://hl7.org/fhir/ValueSet/benefit-subcategory); Type of service or product**

 Health Care Service Type Codes  to identify the classification of service or benefits.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); Service or Product**

 A code to indicate the Professional Service or Product supplied.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "service")]
    pub service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_service")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub service_ext: Option<FieldExtension>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Service/Product billing modifiers**

 Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifier")]
    pub modifier: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_modifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub modifier_ext: Vec<Option<FieldExtension>>,
    /** **Professional fee or Product charge**

 The fee charged for the professional service or product..

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "fee")]
    pub fee: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_fee")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub fee_ext: Option<FieldExtension>,
    /** **List of note numbers which apply**

 A list of note references to the notes provided below.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "noteNumber")]
    pub note_number: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_noteNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_number_ext: Vec<Option<FieldExtension>>,
    /** **Added items detail adjudication**

 The adjudications results.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "adjudication")]
    pub adjudication: Vec<Option<ClaimResponseItemAdjudication>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_adjudication")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub adjudication_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ClaimResponseAddItemDetail {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimResponseAddItemDetailBuilder {
        ClaimResponseAddItemDetailBuilder::default()
    }
}
/// Sub-fields of the error field in ClaimResponse
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimResponseErrorBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimResponseError {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Item sequence number**

 The sequence number of the line item submitted which contains the error. This value is omitted when the error is elsewhere.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sequenceLinkId")]
    pub sequence_link_id: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequenceLinkId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_link_id_ext: Option<FieldExtension>,
    /** **Detail sequence number**

 The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "detailSequenceLinkId")]
    pub detail_sequence_link_id: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_detailSequenceLinkId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub detail_sequence_link_id_ext: Option<FieldExtension>,
    /** **Subdetail sequence number**

 The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subdetailSequenceLinkId")]
    pub subdetail_sequence_link_id: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subdetailSequenceLinkId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subdetail_sequence_link_id_ext: Option<FieldExtension>,
    /** **[AdjudicationError](http://hl7.org/fhir/ValueSet/adjudication-error); Error code detailing processing issues**

 An error code,from a specified code system, which details why the claim could not be adjudicated.

 */
    #[serde(rename = "code")]
    pub code: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ClaimResponseError {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimResponseErrorBuilder {
        ClaimResponseErrorBuilder::default()
    }
}
/// Sub-fields of the payment field in ClaimResponse
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimResponsePaymentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimResponsePayment {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[PaymentType](http://hl7.org/fhir/ValueSet/ex-paymenttype); Partial or Complete**

 Whether this represents partial or complete payment of the claim.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Payment adjustment for non-Claim issues**

 Adjustment to the payment of this transaction which is not related to adjudication of this transaction.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "adjustment")]
    pub adjustment: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_adjustment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub adjustment_ext: Option<FieldExtension>,
    /** **[PaymentAdjustmentReason](http://hl7.org/fhir/ValueSet/payment-adjustment-reason); Explanation for the non-claim adjustment**

 Reason for the payment adjustment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "adjustmentReason")]
    pub adjustment_reason: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_adjustmentReason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub adjustment_reason_ext: Option<FieldExtension>,
    /** **Expected data of Payment**

 Estimated payment data.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Payable amount after adjustment**

 Payable less any payment adjustment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "amount")]
    pub amount: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_amount")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub amount_ext: Option<FieldExtension>,
    /** **Identifier of the payment instrument**

 Payment identifier.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ClaimResponsePayment {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimResponsePaymentBuilder {
        ClaimResponsePaymentBuilder::default()
    }
}
/// Sub-fields of the processNote field in ClaimResponse
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimResponseProcessNoteBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimResponseProcessNote {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Sequence Number for this note**

 An integer associated with each note which may be referred to from each service line item.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "number")]
    pub number: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_number")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub number_ext: Option<FieldExtension>,
    /** **[NoteType](http://hl7.org/fhir/ValueSet/note-type); display | print | printoper**

 The note purpose: Print/Display.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Note explanatory text**

 The note text.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_text")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub text_ext: Option<FieldExtension>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language if different from the resource**

 The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. "en" for English, or "en-US" for American English versus "en-EN" for England English.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_language")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub language_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ClaimResponseProcessNote {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimResponseProcessNoteBuilder {
        ClaimResponseProcessNoteBuilder::default()
    }
}
/// Sub-fields of the insurance field in ClaimResponse
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClaimResponseInsuranceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClaimResponseInsurance {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Service instance identifier**

 A service line item.

 */
    #[serde(rename = "sequence")]
    pub sequence: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_ext: Option<FieldExtension>,
    /** **Is the focal Coverage**

 The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim is to be adjudicated.

 */
    #[serde(rename = "focal")]
    pub focal: bool,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_focal")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub focal_ext: Option<FieldExtension>,
    /** **Insurance information**

 Reference to the program or plan identification, underwriter or payor.

 */
    #[serde(rename = "coverage")]
    pub coverage: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_coverage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub coverage_ext: Option<FieldExtension>,
    /** **Business agreement**

 The contract number of a business agreement which describes the terms and conditions.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "businessArrangement")]
    pub business_arrangement: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_businessArrangement")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub business_arrangement_ext: Option<FieldExtension>,
    /** **Pre-Authorization/Determination Reference**

 A list of references from the Insurer to which these services pertain.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "preAuthRef")]
    pub pre_auth_ref: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_preAuthRef")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub pre_auth_ref_ext: Vec<Option<FieldExtension>>,
    /** **Adjudication results**

 The Coverages adjudication details.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "claimResponse")]
    pub claim_response: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_claimResponse")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub claim_response_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ClaimResponseInsurance {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClaimResponseInsuranceBuilder {
        ClaimResponseInsuranceBuilder::default()
    }
}
/** Base StructureDefinition for ClinicalImpression Resource

 **[ClinicalImpression](http://hl7.org/fhir/StructureDefinition/ClinicalImpression) v3.0.2**

 A clinical assessment performed when planning treatments and management strategies for a patient

 A record of a clinical assessment performed to determine what problem(s) may affect the patient and before planning the treatments or management strategies that are best to manage a patient's condition. Assessments are often 1:1 with a clinical consultation / encounter,  but this varies greatly depending on the clinical workflow. This resource is called "ClinicalImpression" rather than "ClinicalAssessment" to avoid confusion with the recording of assessment tools such as Apgar score.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ClinicalImpression(pub Box<ClinicalImpressionInner>);
/** Base StructureDefinition for ClinicalImpression Resource

 **[ClinicalImpression](http://hl7.org/fhir/StructureDefinition/ClinicalImpression) v3.0.2**

 A clinical assessment performed when planning treatments and management strategies for a patient

 A record of a clinical assessment performed to determine what problem(s) may affect the patient and before planning the treatments or management strategies that are best to manage a patient's condition. Assessments are often 1:1 with a clinical consultation / encounter,  but this varies greatly depending on the clinical workflow. This resource is called "ClinicalImpression" rather than "ClinicalAssessment" to avoid confusion with the recording of assessment tools such as Apgar score.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClinicalImpressionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ClinicalImpressionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ClinicalImpression::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ClinicalImpression", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business identifier**

 A unique identifier assigned to the clinical impression that remains consistent regardless of what server the impression is stored on.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[ClinicalImpressionStatus](http://hl7.org/fhir/ValueSet/clinical-impression-status); draft | completed | entered-in-error**

 Identifies the workflow status of the assessment.

 This element is labeled as a modifier because the status contains the code entered-in-error that marks the clinical impression as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::ClinicalImpressionStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[ClinicalImpressionCode](); Kind of assessment performed**

 Categorizes the type of clinical assessment performed.

 This is present as a place-holder only and may be removed based on feedback/work group opinion. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Why/how the assessment was performed**

 A summary of the context and/or cause of the assessment - why / where was it performed, and what patient events/status prompted it.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Patient or group assessed**

 The patient or group of individuals assessed as part of this record.

 */
    #[serde(rename = "subject")]
    pub subject: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Encounter or Episode created from**

 The encounter or episode of care this impression was created as part of.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **Time of assessment**

 The point in time or period over which the subject was assessed.

 This SHOULD be accurate to at least the minute, though some assessments only have a known date. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub effective: Option<ClinicalImpressionEffective>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub effective_ext: Option<ClinicalImpressionEffectiveExtension>,
    /** **When the assessment was documented**

 Indicates when the documentation of the assessment was complete.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **The clinician performing the assessment**

 The clinician performing the assessment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "assessor")]
    pub assessor: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_assessor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub assessor_ext: Option<FieldExtension>,
    /** **Reference to last assessment**

 A reference to the last assesment that was conducted bon this patient. Assessments are often/usually ongoing in nature; a care provider (practitioner or team) will make new assessments on an ongoing basis as new data arises or the patient's conditions changes.

 It is always likely that multiple previous assessments exist for a patient. The point of quoting a previous assessment is that this assessment is relative to it (see resolved). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "previous")]
    pub previous: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_previous")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub previous_ext: Option<FieldExtension>,
    /** **Relevant impressions of patient state**

 This a list of the relevant problems/conditions for a patient.

 e.g. The patient is a pregnant, and cardiac congestive failure, ‎Adenocarcinoma, and is allergic to penicillin. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "problem")]
    pub problem: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_problem")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub problem_ext: Vec<Option<FieldExtension>>,
    /** **One or more sets of investigations (signs, symptions, etc.)**

 One or more sets of investigations (signs, symptions, etc.). The actual grouping of investigations vary greatly depending on the type and context of the assessment. These investigations may include data generated during the assessment process, or data previously generated and recorded that is pertinent to the outcomes.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "investigation")]
    pub investigation: Vec<Option<ClinicalImpressionInvestigation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_investigation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub investigation_ext: Vec<Option<FieldExtension>>,
    /** **Clinical Protocol followed**

 Reference to a specific published clinical protocol that was followed during this assessment, and/or that provides evidence in support of the diagnosis.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "protocol")]
    pub protocol: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_protocol")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub protocol_ext: Vec<Option<FieldExtension>>,
    /** **Summary of the assessment**

 A text summary of the investigations and the diagnosis.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "summary")]
    pub summary: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_summary")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub summary_ext: Option<FieldExtension>,
    /** **Possible or likely findings and diagnoses**

 Specific findings or diagnoses that was considered likely or relevant to ongoing treatment.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "finding")]
    pub finding: Vec<Option<ClinicalImpressionFinding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_finding")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub finding_ext: Vec<Option<FieldExtension>>,
    /** **[ClinicalImpressionPrognosis](http://hl7.org/fhir/ValueSet/clinicalimpression-prognosis); Estimate of likely outcome**

 Estimate of likely outcome.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "prognosisCodeableConcept")]
    pub prognosis_codeable_concept: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_prognosisCodeableConcept")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub prognosis_codeable_concept_ext: Vec<Option<FieldExtension>>,
    /** **RiskAssessment expressing likely outcome**

 RiskAssessment expressing likely outcome.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "prognosisReference")]
    pub prognosis_reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_prognosisReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub prognosis_reference_ext: Vec<Option<FieldExtension>>,
    /** **Action taken as part of assessment procedure**

 Action taken as part of assessment procedure.

 Actions recommended as a result of the impression should not be captured using the 'action' element. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "action")]
    pub action: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_action")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub action_ext: Vec<Option<FieldExtension>>,
    /** **Comments made about the ClinicalImpression**

 Commentary about the impression, typically recorded after the impression itself was made, though supplemental notes by the original author could also appear.

 Don't use this element for content that should more properly appear as one of the specific elements of the impression. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ClinicalImpressionBuilder {
    #[doc = concat!("Finalize building ", "ClinicalImpression", ".")]
    pub fn build(self) -> Result<ClinicalImpression, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ClinicalImpressionInner> for ClinicalImpression {
    fn from(inner: ClinicalImpressionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ClinicalImpression {
    type Target = ClinicalImpressionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ClinicalImpression {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ClinicalImpression {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ClinicalImpressionBuilder {
        ClinicalImpressionBuilder::default()
    }
}
impl ClinicalImpression {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ClinicalImpression
    }
}
/// Choice of types for the effective[x] field in ClinicalImpression
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClinicalImpressionEffective {
    /// Variant accepting the DateTime type.
    #[serde(rename = "effectiveDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "effectivePeriod")]
    Period(Period),
}
/// Extension value for ClinicalImpressionEffective.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClinicalImpressionEffectiveExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_effectiveDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_effectivePeriod")]
    Period(FieldExtension),
}
/// Sub-fields of the investigation field in ClinicalImpression
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClinicalImpressionInvestigationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClinicalImpressionInvestigation {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[InvestigationGroupType](http://hl7.org/fhir/ValueSet/investigation-sets); A name/code for the set**

 A name/code for the group ("set") of investigations. Typically, this will be something like "signs", "symptoms", "clinical", "diagnostic", but the list is not constrained, and others such groups such as (exposure|family|travel|nutitirional) history may be used.

 */
    #[serde(rename = "code")]
    pub code: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Record of a specific investigation**

 A record of a specific investigation that was undertaken.

 Most investigations are observations of one kind of or another but some other specific types of data collection resources can also be used. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "item")]
    pub item: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_item")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub item_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ClinicalImpressionInvestigation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClinicalImpressionInvestigationBuilder {
        ClinicalImpressionInvestigationBuilder::default()
    }
}
/// Sub-fields of the finding field in ClinicalImpression
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ClinicalImpressionFindingBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ClinicalImpressionFinding {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **What was found**

 Specific text, code or reference for finding or diagnosis, which may include ruled-out or resolved conditions.

 */
    #[serde(flatten)]
    pub item: ClinicalImpressionFindingItem,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub item_ext: Option<ClinicalImpressionFindingItemExtension>,
    /** **Which investigations support finding**

 Which investigations support finding or diagnosis.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basis")]
    pub basis: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_basis")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub basis_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ClinicalImpressionFinding {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ClinicalImpressionFindingBuilder {
        ClinicalImpressionFindingBuilder::default()
    }
}
/// Choice of types for the item[x] field in ClinicalImpressionFinding
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClinicalImpressionFindingItem {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "itemCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "itemReference")]
    Reference(Reference),
}
/// Extension value for ClinicalImpressionFindingItem.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ClinicalImpressionFindingItemExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_itemCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_itemReference")]
    Reference(FieldExtension),
}
/** Base StructureDefinition for CodeSystem Resource

 **[CodeSystem](http://hl7.org/fhir/StructureDefinition/CodeSystem) v3.0.2**

 A set of codes drawn from one or more code systems

 A code system resource specifies a set of codes drawn from one or more code systems.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct CodeSystem(pub Box<CodeSystemInner>);
/** Base StructureDefinition for CodeSystem Resource

 **[CodeSystem](http://hl7.org/fhir/StructureDefinition/CodeSystem) v3.0.2**

 A set of codes drawn from one or more code systems

 A code system resource specifies a set of codes drawn from one or more code systems.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CodeSystemBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct CodeSystemInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "CodeSystem::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::CodeSystem", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical URI to reference this code system (globally unique) (Coding.system)**

 An absolute URI that is used to identify this code system when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this code system is (or will be) published. The URL SHOULD include the major version of the code system. For more information see [Technical and Business Versions](resource.html#versions). This is used in [Coding]{datatypes.html#Coding}.system.

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred.  Multiple instances may share the same url if they have a distinct version. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "url")]
    pub url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Additional identifier for the code system**

 A formal identifier that is used to identify this code system when it is represented in other formats, or referenced in a specification, model, design or an instance.

 Typically, this is used for identifiers that can go in an HL7 V3 II (instance identifier) data type, e.g., to identify this code system outside of FHIR, where it is not possible to use the logical URI. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **Business version of the code system (Coding.version)**

 The identifier that is used to identify this version of the code system when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the code system author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence. This is used in [Coding]{datatypes.html#Coding}.version.

 There may be different code system instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a refrence to a particular business version of the code system with the format [url]|[version]. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Name for this code system (computer friendly)**

 A natural language name identifying the code system. This name should be usable as an identifier for the module by machine processing applications such as code generation.

 The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure that it is computable friendly. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Name for this code system (human friendly)**

 A short, descriptive, user-friendly title for the code system.

 This name does not need to be machine-processing friendly and may contain punctuation, white-space, etc. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this code system. Enables tracking the life-cycle of the content.

 Allows filtering of code systems that are appropriate for use vs. not.
This is labeled as "Is Modifier" because applications should not use a retired code system without due consideration. */
    #[serde(rename = "status")]
    pub status: codes::PublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **For testing purposes, not real usage**

 A boolean value to indicate that this code system is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of code system that are appropriate for use vs. not. This is labeled as "Is Modifier" because applications should not use an experimental code system in production. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "experimental")]
    pub experimental: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_experimental")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub experimental_ext: Option<FieldExtension>,
    /** **Date this was last changed**

 The date  (and optionally time) when the code system was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the code system changes.

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the code system. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Name of the publisher (organization or individual)**

 The name of the individual or organization that published the code system.

 Usually an organization, but may be an individual. The publisher (or steward) of the code system is the organization or individual primarily responsible for the maintenance and upkeep of the code system. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the code system. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisher")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_ext: Option<FieldExtension>,
    /** **Contact details for the publisher**

 Contact details to assist a user in finding and communicating with the publisher.

 May be a web site, an email address, a telephone number, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Natural language description of the code system**

 A free text natural language description of the code system from a consumer's perspective.

 This description can be used to capture details such as why the code system was built, comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the code system as conveyed in the 'text' field of the resource itself. This item SHOULD be populated unless the information is available from context (e.g. the language of the profile is presumed to be the predominant language in the place the profile was created). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Context the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate code system instances.

 When multiple useContexts are specified, there is no expectation whether all or any of the contexts apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useContext")]
    pub use_context: Vec<Option<UsageContext>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_useContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_context_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Intended jurisdiction for code system (if applicable)**

 A legal or geographic region in which the code system is intended to be used.

 It may be possible for the code system to be used in jurisdictions other than those for which it was originally designed or intended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **Why this code system is defined**

 Explaination of why this code system is needed and why it has been designed as it has.

 This element does not describe the usage of the code system Instead  it provides traceability of ''why'' the resource is either needed or ''why'' it is defined as it is.  This may be used to point to source materials or specifications that drove the structure of this code system. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purpose")]
    pub purpose: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_purpose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub purpose_ext: Option<FieldExtension>,
    /** **Use and/or publishing restrictions**

 A copyright statement relating to the code system and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the code system.

 ... Sometimes, the copyright differs between the code system and the codes that are included. The copyright statement should clearly differentiate between these when required. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyright")]
    pub copyright: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyright")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_ext: Option<FieldExtension>,
    /** **If code comparison is case sensitive**

 If code comparison is case sensitive when codes within this system are compared to each other.

 If this value is missing, then it is not specified whether a code system is case sensitive or not. When the rule is not known, Postel's law should be followed: produce codes with the correct case, and accept codes in any case. This element is primarily provided to support validation software. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "caseSensitive")]
    pub case_sensitive: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_caseSensitive")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub case_sensitive_ext: Option<FieldExtension>,
    /** **Canonical URL for value set with entire code system**

 Canonical URL of value set that contains the entire code system.

 The definition of the value set SHALL include all codes from this code system, and it SHALL be immutable. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "valueSet")]
    pub value_set: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_valueSet")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_set_ext: Option<FieldExtension>,
    /** **[CodeSystemHierarchyMeaning](http://hl7.org/fhir/ValueSet/codesystem-hierarchy-meaning); grouped-by | is-a | part-of | classified-with**

 The meaning of the hierarchy of concepts.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "hierarchyMeaning")]
    pub hierarchy_meaning: Option<codes::CodeSystemHierarchyMeaning>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_hierarchyMeaning")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub hierarchy_meaning_ext: Option<FieldExtension>,
    /** **If code system defines a post-composition grammar**

 True If code system defines a post-composition grammar.

 Note that the code system resource does not define what the compositional grammar is, only whether or not there is one. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "compositional")]
    pub compositional: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_compositional")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub compositional_ext: Option<FieldExtension>,
    /** **If definitions are not stable**

 This flag is used to signify that the code system has not (or does not) maintain the definitions, and a version must be specified when referencing this code system.

 Best practice is that code systems do not redefine concepts, or that if concepts are redefined, a new code system definition is created. But this is not always possible, so some code systems may be defined as 'versionNeeded'. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "versionNeeded")]
    pub version_needed: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_versionNeeded")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_needed_ext: Option<FieldExtension>,
    /** **[CodeSystemContentMode](http://hl7.org/fhir/ValueSet/codesystem-content-mode); not-present | example | fragment | complete**

 How much of the content of the code system - the concepts and codes it defines - are represented in this resource.

 */
    #[serde(rename = "content")]
    pub content: codes::CodeSystemContentMode,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_content")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub content_ext: Option<FieldExtension>,
    /** **Total concepts in the code system**

 The total number of concepts defined by the code system. Where the code system has a compositional grammar, the count refers to the number of base (primitive) concepts.

 The count of concepts defined in this resource cannot be more than this value, but may be less for several reasons - see the content value. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "count")]
    pub count: Option<u32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_count")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub count_ext: Option<FieldExtension>,
    /** **Filter that can be used in a value set**

 A filter that can be used in a value set compose statement when selecting concepts using a filter.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "filter")]
    pub filter: Vec<Option<CodeSystemFilter>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_filter")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub filter_ext: Vec<Option<FieldExtension>>,
    /** **Additional information supplied about each concept**

 A property defines an additional slot through which additional information can be provided about a concept.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "property")]
    pub property: Vec<Option<CodeSystemProperty>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_property")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub property_ext: Vec<Option<FieldExtension>>,
    /** **Concepts in the code system**

 Concepts that are in the code system. The concept definitions are inherently hierarchical, but the definitions must be consulted to determine what the meaning of the hierarchical relationships are.

 If this is empty, it means that the code system resource does not represent the content of the code system. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "concept")]
    pub concept: Vec<Option<CodeSystemConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_concept")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub concept_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl CodeSystemBuilder {
    #[doc = concat!("Finalize building ", "CodeSystem", ".")]
    pub fn build(self) -> Result<CodeSystem, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<CodeSystemInner> for CodeSystem {
    fn from(inner: CodeSystemInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for CodeSystem {
    type Target = CodeSystemInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for CodeSystem {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl CodeSystem {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> CodeSystemBuilder {
        CodeSystemBuilder::default()
    }
}
impl CodeSystem {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::CodeSystem
    }
}
/// Sub-fields of the filter field in CodeSystem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CodeSystemFilterBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CodeSystemFilter {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Code that identifies the filter**

 The code that identifies this filter when it is used in the instance.

 */
    #[serde(rename = "code")]
    pub code: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **How or why the filter is used**

 A description of how or why the filter is used.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **[FilterOperator](http://hl7.org/fhir/ValueSet/filter-operator); Operators that can be used with filter**

 A list of operators that can be used with the filter.

 */
    #[serde(rename = "operator")]
    pub operator: Vec<Option<codes::FilterOperator>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_operator")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub operator_ext: Vec<Option<FieldExtension>>,
    /** **What to use for the value**

 A description of what the value for the filter should be.

 */
    #[serde(rename = "value")]
    pub value: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_value")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CodeSystemFilter {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CodeSystemFilterBuilder {
        CodeSystemFilterBuilder::default()
    }
}
/// Sub-fields of the property field in CodeSystem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CodeSystemPropertyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CodeSystemProperty {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Identifies the property on the concepts, and when referred to in operations**

 A code that is used to identify the property. The code is used internally (in CodeSystem.concept.property.code) and also externally, such as in property filters.

 */
    #[serde(rename = "code")]
    pub code: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Formal identifier for the property**

 Reference to the formal meaning of the property. One possible source of meaning is the [Concept Properties](codesystem-concept-properties.html) code system.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "uri")]
    pub uri: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_uri")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub uri_ext: Option<FieldExtension>,
    /** **Why the property is defined, and/or what it conveys**

 A description of the property- why it is defined, and how its value might be used.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **[PropertyType](http://hl7.org/fhir/ValueSet/concept-property-type); code | Coding | string | integer | boolean | dateTime**

 The type of the property value. Properties of type "code" contain a code defined by the code system (e.g. a reference to anotherr defined concept).

 */
    #[serde(rename = "type")]
    pub r#type: codes::PropertyType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CodeSystemProperty {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CodeSystemPropertyBuilder {
        CodeSystemPropertyBuilder::default()
    }
}
/// Sub-fields of the concept field in CodeSystem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CodeSystemConceptBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CodeSystemConcept {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Code that identifies concept**

 A code - a text symbol - that uniquely identifies the concept within the code system.

 */
    #[serde(rename = "code")]
    pub code: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Text to display to the user**

 A human readable string that is the recommended default way to present this concept to a user.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "display")]
    pub display: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_display")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub display_ext: Option<FieldExtension>,
    /** **Formal definition**

 The formal definition of the concept. The code system resource does not make formal definitions required, because of the prevalence of legacy systems. However, they are highly recommended, as without them there is no formal meaning associated with the concept.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definition")]
    pub definition: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_definition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub definition_ext: Option<FieldExtension>,
    /** **Additional representations for the concept**

 Additional representations for the concept - other languages, aliases, specialized purposes, used for particular purposes, etc.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "designation")]
    pub designation: Vec<Option<CodeSystemConceptDesignation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_designation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub designation_ext: Vec<Option<FieldExtension>>,
    /** **Property value for the concept**

 A property value for this concept.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "property")]
    pub property: Vec<Option<CodeSystemConceptProperty>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_property")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub property_ext: Vec<Option<FieldExtension>>,
    /** **Child Concepts (is-a/contains/categorizes)**

 Defines children of a concept to produce a hierarchy of concepts. The nature of the relationships is variable (is-a/contains/categorizes) - see hierarchyMeaning.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "concept")]
    pub concept: Vec<Option<CodeSystemConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_concept")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub concept_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl CodeSystemConcept {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CodeSystemConceptBuilder {
        CodeSystemConceptBuilder::default()
    }
}
/// Sub-fields of the designation field in CodeSystemConcept
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CodeSystemConceptDesignationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CodeSystemConceptDesignation {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Human language of the designation**

 The language this designation is defined for.

 In the absence of a language, the resource language applies. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_language")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub language_ext: Option<FieldExtension>,
    /** **[ConceptDesignationUse](http://hl7.org/fhir/ValueSet/designation-use); Details how this designation would be used**

 A code that details how this designation would be used.

 If no use is provided, the designation can be assumed to be suitable for general display to a human user. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "use")]
    pub r#use: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_use")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#use_ext: Option<FieldExtension>,
    /** **The text value for this designation**

 The text value for this designation.

 */
    #[serde(rename = "value")]
    pub value: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_value")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CodeSystemConceptDesignation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CodeSystemConceptDesignationBuilder {
        CodeSystemConceptDesignationBuilder::default()
    }
}
/// Sub-fields of the property field in CodeSystemConcept
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CodeSystemConceptPropertyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CodeSystemConceptProperty {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Reference to CodeSystem.property.code**

 A code that is a reference to CodeSystem.property.code.

 */
    #[serde(rename = "code")]
    pub code: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Value of the property for this concept**

 The value of this property.

 */
    #[serde(flatten)]
    pub value: CodeSystemConceptPropertyValue,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<CodeSystemConceptPropertyValueExtension>,
}
#[cfg(feature = "builders")]
impl CodeSystemConceptProperty {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CodeSystemConceptPropertyBuilder {
        CodeSystemConceptPropertyBuilder::default()
    }
}
/// Choice of types for the value[x] field in CodeSystemConceptProperty
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CodeSystemConceptPropertyValue {
    /// Variant accepting the Code type.
    #[serde(rename = "valueCode")]
    Code(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "valueCoding")]
    Coding(Coding),
    /// Variant accepting the String type.
    #[serde(rename = "valueString")]
    String(String),
    /// Variant accepting the Integer type.
    #[serde(rename = "valueInteger")]
    Integer(i32),
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// Variant accepting the DateTime type.
    #[serde(rename = "valueDateTime")]
    DateTime(DateTime),
}
/// Extension value for CodeSystemConceptPropertyValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CodeSystemConceptPropertyValueExtension {
    /// Variant accepting the Code extension.
    #[serde(rename = "_valueCode")]
    Code(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_valueCoding")]
    Coding(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_valueString")]
    String(FieldExtension),
    /// Variant accepting the Integer extension.
    #[serde(rename = "_valueInteger")]
    Integer(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_valueDateTime")]
    DateTime(FieldExtension),
}
/** Base StructureDefinition for Communication Resource

 **[Communication](http://hl7.org/fhir/StructureDefinition/Communication) v3.0.2**

 A record of information transmitted from a sender to a receiver

 An occurrence of information being transmitted; e.g. an alert that was sent to a responsible provider, a public health agency was notified about a reportable condition.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Communication(pub Box<CommunicationInner>);
/** Base StructureDefinition for Communication Resource

 **[Communication](http://hl7.org/fhir/StructureDefinition/Communication) v3.0.2**

 A record of information transmitted from a sender to a receiver

 An occurrence of information being transmitted; e.g. an alert that was sent to a responsible provider, a public health agency was notified about a reportable condition.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CommunicationBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct CommunicationInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Communication::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Communication", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Unique identifier**

 Identifiers associated with this Communication that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Instantiates protocol or definition**

 A protocol, guideline, or other definition that was adhered to in whole or in part by this communication event.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definition")]
    pub definition: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_definition")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub definition_ext: Vec<Option<FieldExtension>>,
    /** **Request fulfilled by this communication**

 An order, proposal or plan fulfilled in whole or in part by this Communication.

 This must point to some sort of a 'Request' resource, such as CarePlan, CommunicationRequest, ReferralRequest, MedicationRequest, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basedOn")]
    pub based_on: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_basedOn")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub based_on_ext: Vec<Option<FieldExtension>>,
    /** **Part of this action**

 Part of this action.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "partOf")]
    pub part_of: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_partOf")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub part_of_ext: Vec<Option<FieldExtension>>,
    /** **[CommunicationStatus](http://hl7.org/fhir/ValueSet/event-status); preparation | in-progress | suspended | aborted | completed | entered-in-error**

 The status of the transmission.

 This element is labeled as a modifier because the status contains the codes aborted and entered-in-error that mark the communication as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::EventStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **Communication did not occur**

 If true, indicates that the described communication event did not actually occur.

 This element is labeled as a modifier because it marks the communication as a communication that did not occur.  The more attributes are populated, the more constrained the negated statement is. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "notDone")]
    pub not_done: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_notDone")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub not_done_ext: Option<FieldExtension>,
    /** **[CommunicationNotDoneReason](http://hl7.org/fhir/ValueSet/communication-not-done-reason); Why communication did not occur**

 Describes why the communication event did not occur in coded and/or textual form.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "notDoneReason")]
    pub not_done_reason: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_notDoneReason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub not_done_reason_ext: Option<FieldExtension>,
    /** **[CommunicationCategory](http://hl7.org/fhir/ValueSet/communication-category); Message category**

 The type of message conveyed such as alert, notification, reminder, instruction, etc.

 There may be multiple axes of categorization and one communication may serve multiple purposes. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub category_ext: Vec<Option<FieldExtension>>,
    /** **[CommunicationMedium](http://hl7.org/fhir/ValueSet/v3-ParticipationMode); A channel of communication**

 A channel that was used for this communication (e.g. email, fax).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "medium")]
    pub medium: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_medium")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub medium_ext: Vec<Option<FieldExtension>>,
    /** **Focus of message**

 The patient or group that was the focus of this communication.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Message recipient**

 The entity (e.g. person, organization, clinical information system, or device) which was the target of the communication. If receipts need to be tracked by individual, a separate resource instance will need to be created for each recipient.  Multiple recipient communications are intended where either a receipt(s) is not tracked (e.g. a mass mail-out) or is captured in aggregate (all emails confirmed received by a particular time).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recipient")]
    pub recipient: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_recipient")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub recipient_ext: Vec<Option<FieldExtension>>,
    /** **Focal resources**

 The resources which were responsible for or related to producing this communication.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "topic")]
    pub topic: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_topic")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub topic_ext: Vec<Option<FieldExtension>>,
    /** **Encounter or episode leading to message**

 The encounter within which the communication was sent.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **When sent**

 The time when this communication was sent.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sent")]
    pub sent: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sent_ext: Option<FieldExtension>,
    /** **When received**

 The time when this communication arrived at the destination.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "received")]
    pub received: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_received")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub received_ext: Option<FieldExtension>,
    /** **Message sender**

 The entity (e.g. person, organization, clinical information system, or device) which was the source of the communication.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sender")]
    pub sender: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sender")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sender_ext: Option<FieldExtension>,
    /** **[CommunicationReason](http://hl7.org/fhir/ValueSet/clinical-findings); Indication for message**

 The reason or justification for the communication.

 Textual reasons can be caprued using reasonCode.text. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonCode")]
    pub reason_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_code_ext: Vec<Option<FieldExtension>>,
    /** **Why was communication done?**

 Indicates another resource whose existence justifies this communication.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonReference")]
    pub reason_reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_reference_ext: Vec<Option<FieldExtension>>,
    /** **Message payload**

 Text, attachment(s), or resource(s) that was communicated to the recipient.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "payload")]
    pub payload: Vec<Option<CommunicationPayload>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_payload")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub payload_ext: Vec<Option<FieldExtension>>,
    /** **Comments made about the communication**

 Additional notes or commentary about the communication by the sender, receiver or other interested parties.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl CommunicationBuilder {
    #[doc = concat!("Finalize building ", "Communication", ".")]
    pub fn build(self) -> Result<Communication, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<CommunicationInner> for Communication {
    fn from(inner: CommunicationInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Communication {
    type Target = CommunicationInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Communication {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Communication {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> CommunicationBuilder {
        CommunicationBuilder::default()
    }
}
impl Communication {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Communication
    }
}
/// Sub-fields of the payload field in Communication
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CommunicationPayloadBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CommunicationPayload {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Message part content**

 A communicated content (or for multi-part communications, one portion of the communication).

 */
    #[serde(flatten)]
    pub content: CommunicationPayloadContent,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub content_ext: Option<CommunicationPayloadContentExtension>,
}
#[cfg(feature = "builders")]
impl CommunicationPayload {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CommunicationPayloadBuilder {
        CommunicationPayloadBuilder::default()
    }
}
/// Choice of types for the content[x] field in CommunicationPayload
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CommunicationPayloadContent {
    /// Variant accepting the String type.
    #[serde(rename = "contentString")]
    String(String),
    /// Variant accepting the Attachment type.
    #[serde(rename = "contentAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Reference type.
    #[serde(rename = "contentReference")]
    Reference(Reference),
}
/// Extension value for CommunicationPayloadContent.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CommunicationPayloadContentExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_contentString")]
    String(FieldExtension),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_contentAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_contentReference")]
    Reference(FieldExtension),
}
/** Base StructureDefinition for CommunicationRequest Resource

 **[CommunicationRequest](http://hl7.org/fhir/StructureDefinition/CommunicationRequest) v3.0.2**

 A request for information to be sent to a receiver

 A request to convey information; e.g. the CDS system proposes that an alert be sent to a responsible provider, the CDS system proposes that the public health agency be notified about a reportable condition.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct CommunicationRequest(pub Box<CommunicationRequestInner>);
/** Base StructureDefinition for CommunicationRequest Resource

 **[CommunicationRequest](http://hl7.org/fhir/StructureDefinition/CommunicationRequest) v3.0.2**

 A request for information to be sent to a receiver

 A request to convey information; e.g. the CDS system proposes that an alert be sent to a responsible provider, the CDS system proposes that the public health agency be notified about a reportable condition.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CommunicationRequestBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct CommunicationRequestInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "CommunicationRequest::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::CommunicationRequest", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Unique identifier**

 A unique ID of this request for reference purposes. It must be provided if user wants it returned as part of any output, otherwise it will be autogenerated, if needed, by CDS system. Does not need to be the actual ID of the source system.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Fulfills plan or proposal**

 A plan or proposal that is fulfilled in whole or in part by this request.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basedOn")]
    pub based_on: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_basedOn")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub based_on_ext: Vec<Option<FieldExtension>>,
    /** **Request(s) replaced by this request**

 Completed or terminated request(s) whose function is taken by this new request.

 The replacement could be because the initial request was immediately rejected (due to an issue) or because the previous request was completed, but the need for the action described by the request remains ongoing. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "replaces")]
    pub replaces: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_replaces")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub replaces_ext: Vec<Option<FieldExtension>>,
    /** **Composite request this is part of**

 A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition, prescription or similar form.

 Requests are linked either by a "basedOn" relationship (i.e. one request is fulfilling another) or by having a common requisition.  Requests that are part of the same requisition are generally treated independently from the perspective of changing their state or maintaining them after initial creation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "groupIdentifier")]
    pub group_identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_groupIdentifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub group_identifier_ext: Option<FieldExtension>,
    /** **[CommunicationRequestStatus](http://hl7.org/fhir/ValueSet/request-status); draft | active | suspended | cancelled | completed | entered-in-error | unknown**

 The status of the proposal or order.

 This element is labeled as a modifier because the status contains the codes cancelled and entered-in-error that mark the request as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::RequestStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[CommunicationCategory](http://hl7.org/fhir/ValueSet/communication-category); Message category**

 The type of message to be sent such as alert, notification, reminder, instruction, etc.

 There may be multiple axes of categorization and one communication request may serve multiple purposes. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub category_ext: Vec<Option<FieldExtension>>,
    /** **[CommunicationPriority](http://hl7.org/fhir/ValueSet/request-priority); Message urgency**

 Characterizes how quickly the proposed act must be initiated. Includes concepts such as stat, urgent, routine.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "priority")]
    pub priority: Option<codes::RequestPriority>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_priority")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub priority_ext: Option<FieldExtension>,
    /** **[CommunicationMedium](http://hl7.org/fhir/ValueSet/v3-ParticipationMode); A channel of communication**

 A channel that was used for this communication (e.g. email, fax).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "medium")]
    pub medium: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_medium")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub medium_ext: Vec<Option<FieldExtension>>,
    /** **Focus of message**

 The patient or group that is the focus of this communication request.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Message recipient**

 The entity (e.g. person, organization, clinical information system, device, group, or care team) which is the intended target of the communication.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recipient")]
    pub recipient: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_recipient")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub recipient_ext: Vec<Option<FieldExtension>>,
    /** **Focal resources**

 The resources which were related to producing this communication request.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "topic")]
    pub topic: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_topic")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub topic_ext: Vec<Option<FieldExtension>>,
    /** **Encounter or episode leading to message**

 The encounter or episode of care within which the communication request was created.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **Message payload**

 Text, attachment(s), or resource(s) to be communicated to the recipient.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "payload")]
    pub payload: Vec<Option<CommunicationRequestPayload>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_payload")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub payload_ext: Vec<Option<FieldExtension>>,
    /** **When scheduled**

 The time when this communication is to occur.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub occurrence: Option<CommunicationRequestOccurrence>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub occurrence_ext: Option<CommunicationRequestOccurrenceExtension>,
    /** **When request transitioned to being actionable**

 For draft requests, indicates the date of initial creation.  For requests with other statuses, indicates the date of activation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authoredOn")]
    pub authored_on: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_authoredOn")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub authored_on_ext: Option<FieldExtension>,
    /** **Message sender**

 The entity (e.g. person, organization, clinical information system, or device) which is to be the source of the communication.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sender")]
    pub sender: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sender")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sender_ext: Option<FieldExtension>,
    /** **Who/what is requesting service**

 The individual who initiated the request and has responsibility for its activation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requester")]
    pub requester: Option<CommunicationRequestRequester>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requester")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub requester_ext: Option<FieldExtension>,
    /** **[CommunicationReason](http://hl7.org/fhir/ValueSet/v3-ActReason); Why is communication needed?**

 Describes why the request is being made in coded or textual form.

 Textual reasons can be caprued using reasonCode.text. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonCode")]
    pub reason_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_code_ext: Vec<Option<FieldExtension>>,
    /** **Why is communication needed?**

 Indicates another resource whose existence justifies this request.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonReference")]
    pub reason_reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_reference_ext: Vec<Option<FieldExtension>>,
    /** **Comments made about communication request**

 Comments made about the request by the requester, sender, recipient, subject or other participants.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl CommunicationRequestBuilder {
    #[doc = concat!("Finalize building ", "CommunicationRequest", ".")]
    pub fn build(self) -> Result<CommunicationRequest, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<CommunicationRequestInner> for CommunicationRequest {
    fn from(inner: CommunicationRequestInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for CommunicationRequest {
    type Target = CommunicationRequestInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for CommunicationRequest {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl CommunicationRequest {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> CommunicationRequestBuilder {
        CommunicationRequestBuilder::default()
    }
}
impl CommunicationRequest {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::CommunicationRequest
    }
}
/// Sub-fields of the payload field in CommunicationRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CommunicationRequestPayloadBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CommunicationRequestPayload {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Message part content**

 The communicated content (or for multi-part communications, one portion of the communication).

 */
    #[serde(flatten)]
    pub content: CommunicationRequestPayloadContent,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub content_ext: Option<CommunicationRequestPayloadContentExtension>,
}
#[cfg(feature = "builders")]
impl CommunicationRequestPayload {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CommunicationRequestPayloadBuilder {
        CommunicationRequestPayloadBuilder::default()
    }
}
/// Choice of types for the content[x] field in CommunicationRequestPayload
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CommunicationRequestPayloadContent {
    /// Variant accepting the String type.
    #[serde(rename = "contentString")]
    String(String),
    /// Variant accepting the Attachment type.
    #[serde(rename = "contentAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Reference type.
    #[serde(rename = "contentReference")]
    Reference(Reference),
}
/// Extension value for CommunicationRequestPayloadContent.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CommunicationRequestPayloadContentExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_contentString")]
    String(FieldExtension),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_contentAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_contentReference")]
    Reference(FieldExtension),
}
/// Choice of types for the occurrence[x] field in CommunicationRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CommunicationRequestOccurrence {
    /// Variant accepting the DateTime type.
    #[serde(rename = "occurrenceDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "occurrencePeriod")]
    Period(Period),
}
/// Extension value for CommunicationRequestOccurrence.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CommunicationRequestOccurrenceExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_occurrenceDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_occurrencePeriod")]
    Period(FieldExtension),
}
/// Sub-fields of the requester field in CommunicationRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CommunicationRequestRequesterBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CommunicationRequestRequester {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Individual making the request**

 The device, practitioner, etc. who initiated the request.

 */
    #[serde(rename = "agent")]
    pub agent: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_agent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub agent_ext: Option<FieldExtension>,
    /** **Organization agent is acting for**

 The organization the device or practitioner was acting on behalf of.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "onBehalfOf")]
    pub on_behalf_of: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_onBehalfOf")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub on_behalf_of_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CommunicationRequestRequester {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CommunicationRequestRequesterBuilder {
        CommunicationRequestRequesterBuilder::default()
    }
}
/** Base StructureDefinition for CompartmentDefinition Resource

 **[CompartmentDefinition](http://hl7.org/fhir/StructureDefinition/CompartmentDefinition) v3.0.2**

 Compartment Definition for a resource

 A compartment definition that defines how resources are accessed on a server.

 In FHIR, search is not performed directly on a resource (by XML or JSON path), but on a named parameter that maps into the resource content. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct CompartmentDefinition(pub Box<CompartmentDefinitionInner>);
/** Base StructureDefinition for CompartmentDefinition Resource

 **[CompartmentDefinition](http://hl7.org/fhir/StructureDefinition/CompartmentDefinition) v3.0.2**

 Compartment Definition for a resource

 A compartment definition that defines how resources are accessed on a server.

 In FHIR, search is not performed directly on a resource (by XML or JSON path), but on a named parameter that maps into the resource content. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CompartmentDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct CompartmentDefinitionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "CompartmentDefinition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::CompartmentDefinition", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical URI to reference this compartment definition (globally unique)**

 An absolute URI that is used to identify this compartment definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this compartment definition is (or will be) published. The URL SHOULD include the major version of the compartment definition. For more information see [Technical and Business Versions](resource.html#versions).

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred.  Multiple instances may share the same url if they have a distinct version. */
    #[serde(rename = "url")]
    pub url: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Name for this compartment definition (computer friendly)**

 A natural language name identifying the compartment definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.

 The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure that it is computable friendly. This is often the same as the code for the parameter, but does not need to be. */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Name for this compartment definition (human friendly)**

 A short, descriptive, user-friendly title for the compartment definition.

 This name does not need to be machine-processing friendly and may contain punctuation, white-space, etc. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this compartment definition. Enables tracking the life-cycle of the content.

 Allows filtering of compartment definitions that are appropriate for use vs. not.
This is labeled as "Is Modifier" because applications should not use a retired compartment definition without due consideration. */
    #[serde(rename = "status")]
    pub status: codes::PublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **For testing purposes, not real usage**

 A boolean value to indicate that this compartment definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of compartment definition that are appropriate for use vs. not. This is labeled as "Is Modifier" because applications should not use an experimental compartment definition in production. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "experimental")]
    pub experimental: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_experimental")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub experimental_ext: Option<FieldExtension>,
    /** **Date this was last changed**

 The date  (and optionally time) when the compartment definition was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the compartment definition changes.

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the compartment definition. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Name of the publisher (organization or individual)**

 The name of the individual or organization that published the compartment definition.

 Usually an organization, but may be an individual. The publisher (or steward) of the compartment definition is the organization or individual primarily responsible for the maintenance and upkeep of the compartment definition. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the compartment definition. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisher")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_ext: Option<FieldExtension>,
    /** **Contact details for the publisher**

 Contact details to assist a user in finding and communicating with the publisher.

 May be a web site, an email address, a telephone number, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Natural language description of the compartment definition**

 A free text natural language description of the compartment definition from a consumer's perspective.

 This description can be used to capture details such as why the compartment definition was built, comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the compartment definition as conveyed in the 'text' field of the resource itself. This item SHOULD be populated unless the information is available from context (e.g. the language of the profile is presumed to be the predominant language in the place the profile was created). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Why this compartment definition is defined**

 Explaination of why this compartment definition is needed and why it has been designed as it has.

 This element does not describe the usage of the compartment definition Instead  it provides traceability of ''why'' the resource is either needed or ''why'' it is defined as it is.  This may be used to point to source materials or specifications that drove the structure of this compartment definition. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purpose")]
    pub purpose: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_purpose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub purpose_ext: Option<FieldExtension>,
    /** **Context the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate compartment definition instances.

 When multiple useContexts are specified, there is no expectation whether all or any of the contexts apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useContext")]
    pub use_context: Vec<Option<UsageContext>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_useContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_context_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Intended jurisdiction for compartment definition (if applicable)**

 A legal or geographic region in which the compartment definition is intended to be used.

 It may be possible for the compartment definition to be used in jurisdictions other than those for which it was originally designed or intended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **[CompartmentType](http://hl7.org/fhir/ValueSet/compartment-type); Patient | Encounter | RelatedPerson | Practitioner | Device**

 Which compartment this definition describes.

 Only the specification can define the compartments that can exist. Servers can choose to support them. */
    #[serde(rename = "code")]
    pub code: codes::CompartmentType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Whether the search syntax is supported**

 Whether the search syntax is supported,.

 Servers may define and use compartments to manage logical access without implementing the compartment related syntax. */
    #[serde(rename = "search")]
    pub search: bool,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_search")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub search_ext: Option<FieldExtension>,
    /** **How a resource is related to the compartment**

 Information about how a resource is related to the compartment.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "resource")]
    pub resource: Vec<Option<CompartmentDefinitionResource>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_resource")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub resource_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl CompartmentDefinitionBuilder {
    #[doc = concat!("Finalize building ", "CompartmentDefinition", ".")]
    pub fn build(self) -> Result<CompartmentDefinition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<CompartmentDefinitionInner> for CompartmentDefinition {
    fn from(inner: CompartmentDefinitionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for CompartmentDefinition {
    type Target = CompartmentDefinitionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for CompartmentDefinition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl CompartmentDefinition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> CompartmentDefinitionBuilder {
        CompartmentDefinitionBuilder::default()
    }
}
impl CompartmentDefinition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::CompartmentDefinition
    }
}
/// Sub-fields of the resource field in CompartmentDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CompartmentDefinitionResourceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CompartmentDefinitionResource {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ResourceType](http://hl7.org/fhir/ValueSet/resource-types); Name of resource type**

 The name of a resource supported by the server.

 */
    #[serde(rename = "code")]
    pub code: codes::ResourceType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Search Parameter Name, or chained parameters**

 The name of a search parameter that represents the link to the compartment. More than one may be listed because a resource may be linked to a compartment in more than one way,.

 If no search parameters are listed, then the resource is not linked to the compartment. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "param")]
    pub param: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_param")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub param_ext: Vec<Option<FieldExtension>>,
    /** **Additional documentation about the resource and compartment**

 Additional documentation about the resource and compartment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "documentation")]
    pub documentation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_documentation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub documentation_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CompartmentDefinitionResource {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CompartmentDefinitionResourceBuilder {
        CompartmentDefinitionResourceBuilder::default()
    }
}
/** Base StructureDefinition for Composition Resource

 **[Composition](http://hl7.org/fhir/StructureDefinition/Composition) v3.0.2**

 A set of resources composed into a single coherent clinical statement with clinical attestation

 A set of healthcare-related information that is assembled together into a single logical document that provides a single coherent statement of meaning, establishes its own context and that has clinical attestation with regard to who is making the statement. While a Composition defines the structure, it does not actually contain the content: rather the full content of a document is contained in a Bundle, of which the Composition is the first resource contained.

 While the focus of this specification is on patient-specific clinical statements, this resource can also apply to other healthcare-related statements such as study protocol designs, healthcare invoices and other activities that are not necessarily patient-specific or clinical. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Composition(pub Box<CompositionInner>);
/** Base StructureDefinition for Composition Resource

 **[Composition](http://hl7.org/fhir/StructureDefinition/Composition) v3.0.2**

 A set of resources composed into a single coherent clinical statement with clinical attestation

 A set of healthcare-related information that is assembled together into a single logical document that provides a single coherent statement of meaning, establishes its own context and that has clinical attestation with regard to who is making the statement. While a Composition defines the structure, it does not actually contain the content: rather the full content of a document is contained in a Bundle, of which the Composition is the first resource contained.

 While the focus of this specification is on patient-specific clinical statements, this resource can also apply to other healthcare-related statements such as study protocol designs, healthcare invoices and other activities that are not necessarily patient-specific or clinical. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CompositionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct CompositionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Composition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Composition", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical identifier of composition (version-independent)**

 Logical identifier for the composition, assigned when created. This identifier stays constant as the composition is changed over time.

 See discussion in resource definition for how these relate. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **[CompositionStatus](http://hl7.org/fhir/ValueSet/composition-status); preliminary | final | amended | entered-in-error**

 The workflow/clinical status of this composition. The status is a marker for the clinical standing of the document.

 If a composition is marked as withdrawn, the compositions/documents in the series, or data from the composition or document series, should never be displayed to a user without being clearly marked as untrustworthy. The flag "entered-in-error" is why this element is labeled as a modifier of other elements.

Some reporting work flows require that the original narrative of a final document never be altered; instead, only new narrative can be added. The composition resource has no explicit status for explicitly noting whether this business rule is in effect. This would be handled by an extension if required. */
    #[serde(rename = "status")]
    pub status: codes::CompositionStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[DocumentType](http://hl7.org/fhir/ValueSet/doc-typecodes); Kind of composition (LOINC if possible)**

 Specifies the particular kind of composition (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the composition.

 For Composition type, LOINC is ubiquitous and strongly endorsed by HL7. Most implementation guides will require a specific LOINC code, or use LOINC as an extensible binding. */
    #[serde(rename = "type")]
    pub r#type: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[DocumentClass](http://hl7.org/fhir/ValueSet/doc-classcodes); Categorization of Composition**

 A categorization for the type of the composition - helps for indexing and searching. This may be implied by or derived from the code specified in the Composition Type.

 This is a metadata field from [XDS/MHD](http://wiki.ihe.net/index.php?title=Mobile_access_to_Health_Documents_(MHD)). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "class")]
    pub class: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_class")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub class_ext: Option<FieldExtension>,
    /** **Who and/or what the composition is about**

 Who or what the composition is about. The composition can be about a person, (patient or healthcare practitioner), a device (e.g. a machine) or even a group of subjects (such as a document about a herd of livestock, or a set of patients that share a common exposure).

 For clinical documents, this is usually the patient. */
    #[serde(rename = "subject")]
    pub subject: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Context of the Composition**

 Describes the clinical encounter or type of care this documentation is associated with.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "encounter")]
    pub encounter: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_encounter")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub encounter_ext: Option<FieldExtension>,
    /** **Composition editing time**

 The composition editing time, when the composition was last logically changed by the author.

 The Last Modified Date on the composition may be after the date of the document was attested without being changed. */
    #[serde(rename = "date")]
    pub date: DateTime,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Who and/or what authored the composition**

 Identifies who is responsible for the information in the composition, not necessarily who typed it in.

 */
    #[serde(rename = "author")]
    pub author: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_author")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub author_ext: Vec<Option<FieldExtension>>,
    /** **Human Readable name/title**

 Official human-readable label for the composition.

 For many compositions, the title is the same as the text or a display name of Composition.type (e.g. a "consultation" or "progress note"). Note that CDA does not make title mandatory, but there are no known cases where it is useful for title to be omitted, so it is mandatory here. Feedback on this requirement is welcome during the trial use period. */
    #[serde(rename = "title")]
    pub title: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **[DocumentConfidentiality](http://hl7.org/fhir/ValueSet/v3-ConfidentialityClassification); As defined by affinity domain**

 The code specifying the level of confidentiality of the Composition.

 The exact use of this element, and enforcement and issues related to highly sensitive documents are out of scope for the base specification, and delegated to implementation profiles (see security section).

This element is labeled as a modifier because highly confidential documents must not be treated as if they are not. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "confidentiality")]
    pub confidentiality: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_confidentiality")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub confidentiality_ext: Option<FieldExtension>,
    /** **Attests to accuracy of composition**

 A participant who has attested to the accuracy of the composition/document.

 Only list each attester once. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "attester")]
    pub attester: Vec<Option<CompositionAttester>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_attester")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub attester_ext: Vec<Option<FieldExtension>>,
    /** **Organization which maintains the composition**

 Identifies the organization or group who is responsible for ongoing maintenance of and access to the composition/document information.

 This is useful when documents are derived from a composition - provides guidance for how to get the latest version of the document. This is optional because this is sometimes not known by the authoring system, and can be inferred by context. However, it is important that this information be known when working with a derived document, so providing a custodian is encouraged. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "custodian")]
    pub custodian: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_custodian")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub custodian_ext: Option<FieldExtension>,
    /** **Relationships to other compositions/documents**

 Relationships that this composition has with other compositions or documents that already exist.

 A document is a version specific composition. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relatesTo")]
    pub relates_to: Vec<Option<CompositionRelatesTo>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_relatesTo")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub relates_to_ext: Vec<Option<FieldExtension>>,
    /** **The clinical service(s) being documented**

 The clinical service, such as a colonoscopy or an appendectomy, being documented.

 The event needs to be consistent with the type element, though can provide further information if desired. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "event")]
    pub event: Vec<Option<CompositionEvent>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_event")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub event_ext: Vec<Option<FieldExtension>>,
    /** **Composition is broken into sections**

 The root of the sections that make up the composition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "section")]
    pub section: Vec<Option<CompositionSection>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_section")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub section_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl CompositionBuilder {
    #[doc = concat!("Finalize building ", "Composition", ".")]
    pub fn build(self) -> Result<Composition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<CompositionInner> for Composition {
    fn from(inner: CompositionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Composition {
    type Target = CompositionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Composition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Composition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> CompositionBuilder {
        CompositionBuilder::default()
    }
}
impl Composition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Composition
    }
}
/// Sub-fields of the attester field in Composition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CompositionAttesterBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CompositionAttester {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[CompositionAttestationMode](http://hl7.org/fhir/ValueSet/composition-attestation-mode); personal | professional | legal | official**

 The type of attestation the authenticator offers.

 Use more than one code where a single attester has more than one mode (professional and legal are often paired). */
    #[serde(rename = "mode")]
    pub mode: Vec<Option<codes::CompositionAttestationMode>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_mode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub mode_ext: Vec<Option<FieldExtension>>,
    /** **When the composition was attested**

 When the composition was attested by the party.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "time")]
    pub time: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_time")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub time_ext: Option<FieldExtension>,
    /** **Who attested the composition**

 Who attested the composition in the specified way.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "party")]
    pub party: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_party")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub party_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CompositionAttester {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CompositionAttesterBuilder {
        CompositionAttesterBuilder::default()
    }
}
/// Sub-fields of the relatesTo field in Composition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CompositionRelatesToBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CompositionRelatesTo {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DocumentRelationshipType](http://hl7.org/fhir/ValueSet/document-relationship-type); replaces | transforms | signs | appends**

 The type of relationship that this composition has with anther composition or document.

 If this document appends another document, then the document cannot be fully understood without also accessing the referenced document. */
    #[serde(rename = "code")]
    pub code: codes::DocumentRelationshipType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Target of the relationship**

 The target composition/document of this relationship.

 */
    #[serde(flatten)]
    pub target: CompositionRelatesToTarget,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub target_ext: Option<CompositionRelatesToTargetExtension>,
}
#[cfg(feature = "builders")]
impl CompositionRelatesTo {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CompositionRelatesToBuilder {
        CompositionRelatesToBuilder::default()
    }
}
/// Choice of types for the target[x] field in CompositionRelatesTo
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CompositionRelatesToTarget {
    /// Variant accepting the Identifier type.
    #[serde(rename = "targetIdentifier")]
    Identifier(Identifier),
    /// Variant accepting the Reference type.
    #[serde(rename = "targetReference")]
    Reference(Reference),
}
/// Extension value for CompositionRelatesToTarget.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum CompositionRelatesToTargetExtension {
    /// Variant accepting the Identifier extension.
    #[serde(rename = "_targetIdentifier")]
    Identifier(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_targetReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the event field in Composition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CompositionEventBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CompositionEvent {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DocumentEventType](http://hl7.org/fhir/ValueSet/v3-ActCode); Code(s) that apply to the event being documented**

 This list of codes represents the main clinical acts, such as a colonoscopy or an appendectomy, being documented. In some cases, the event is inherent in the typeCode, such as a "History and Physical Report" in which the procedure being documented is necessarily a "History and Physical" act.

 An event can further specialize the act inherent in the typeCode, such as where it is simply "Procedure Report" and the procedure was a "colonoscopy". If one or more eventCodes are included, they SHALL NOT conflict with the values inherent in the classCode, practiceSettingCode or typeCode, as such a conflict would create an ambiguous situation. This short list of codes is provided to be used as key words for certain types of queries. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub code_ext: Vec<Option<FieldExtension>>,
    /** **The period covered by the documentation**

 The period of time covered by the documentation. There is no assertion that the documentation is a complete representation for this period, only that it documents events during this time.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
    /** **The event(s) being documented**

 The description and/or reference of the event(s) being documented. For example, this could be used to document such a colonoscopy or an appendectomy.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "detail")]
    pub detail: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_detail")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub detail_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl CompositionEvent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CompositionEventBuilder {
        CompositionEventBuilder::default()
    }
}
/// Sub-fields of the section field in Composition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CompositionSectionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CompositionSection {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Label for section (e.g. for ToC)**

 The label for this particular section.  This will be part of the rendered content for the document, and is often used to build a table of contents.

 The title identifies the section for a human reader. The title must be consistent with the narrative of the resource that is the target of the section.content reference. Generally, sections SHOULD have titles, but in some documents, it is unnecessary or inappropriate. Typically, this is where a section has subsections that have their own adequately distinguishing title,  or documents that only have a single section. Most Implementation Guides will make section title to be a required element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **[CompositionSectionType](http://hl7.org/fhir/ValueSet/doc-section-codes); Classification of section (recommended)**

 A code identifying the kind of content contained within the section. This must be consistent with the section title.

 The code identifies the section for an automated processor of the document. This is particularly relevant when using profiles to control the structure of the document.   If the section has content (instead of sub-sections), the section.code does not change the meaning or interpretation of the resource that is the content of the section in the comments for the section.code. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Text summary of the section, for human interpretation**

 A human-readable narrative that contains the attested content of the section, used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative.

 Document profiles may define what content should be represented in the narrative to ensure clinical safety. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_text")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub text_ext: Option<FieldExtension>,
    /** **[SectionMode](http://hl7.org/fhir/ValueSet/list-mode); working | snapshot | changes**

 How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.

 This element is labeled as a modifier because a change list must not be mis-understood as a complete list. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "mode")]
    pub mode: Option<codes::ListMode>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_mode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub mode_ext: Option<FieldExtension>,
    /** **[SectionEntryOrder](http://hl7.org/fhir/ValueSet/list-order); Order of section entries**

 Specifies the order applied to the items in the section entries.

 Applications SHOULD render ordered lists in the order provided, but MAY allow users to re-order based on their own preferences as well. If there is no order specified, the order is unknown, though there may still be some order. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "orderedBy")]
    pub ordered_by: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_orderedBy")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub ordered_by_ext: Option<FieldExtension>,
    /** **A reference to data that supports this section**

 A reference to the actual resource from which the narrative in the section is derived.

 If there are no entries in the list, an emptyReason SHOULD be provided. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "entry")]
    pub entry: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_entry")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub entry_ext: Vec<Option<FieldExtension>>,
    /** **[SectionEmptyReason](http://hl7.org/fhir/ValueSet/list-empty-reason); Why the section is empty**

 If the section is empty, why the list is empty. An empty section typically has some text explaining the empty reason.

 The various reasons for an empty section make a significant interpretation to its interpretation. Note that this code is for use when the entire section content has been suppressed, and not for when individual items are omitted - implementers may consider using a text note or a flag on an entry in these cases. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "emptyReason")]
    pub empty_reason: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_emptyReason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub empty_reason_ext: Option<FieldExtension>,
    /** **Nested Section**

 A nested sub-section within this section.

 Nested sections are primarily used to help human readers navigate to particular portions of the document. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "section")]
    pub section: Vec<Option<CompositionSection>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_section")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub section_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl CompositionSection {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CompositionSectionBuilder {
        CompositionSectionBuilder::default()
    }
}
/** Base StructureDefinition for ConceptMap Resource

 **[ConceptMap](http://hl7.org/fhir/StructureDefinition/ConceptMap) v3.0.2**

 A map from one set of concepts to one or more other concepts

 A statement of relationships from one set of concepts to one or more other concepts - either code systems or data elements, or classes in class models.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ConceptMap(pub Box<ConceptMapInner>);
/** Base StructureDefinition for ConceptMap Resource

 **[ConceptMap](http://hl7.org/fhir/StructureDefinition/ConceptMap) v3.0.2**

 A map from one set of concepts to one or more other concepts

 A statement of relationships from one set of concepts to one or more other concepts - either code systems or data elements, or classes in class models.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConceptMapBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ConceptMapInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ConceptMap::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ConceptMap", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical URI to reference this concept map (globally unique)**

 An absolute URI that is used to identify this concept map when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this concept map is (or will be) published. The URL SHOULD include the major version of the concept map. For more information see [Technical and Business Versions](resource.html#versions).

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred.  Multiple instances may share the same url if they have a distinct version. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "url")]
    pub url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Additional identifier for the concept map**

 A formal identifier that is used to identify this concept map when it is represented in other formats, or referenced in a specification, model, design or an instance.

 Typically, this is used for identifiers that can go in an HL7 V3 II (instance identifier) data type, e.g., to identify this concept map outside of FHIR, where it is not possible to use the logical URI. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **Business version of the concept map**

 The identifier that is used to identify this version of the concept map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the concept map author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.

 There may be different concept map instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a refrence to a particular business version of the concept map with the format [url]|[version]. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Name for this concept map (computer friendly)**

 A natural language name identifying the concept map. This name should be usable as an identifier for the module by machine processing applications such as code generation.

 The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure that it is computable friendly. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Name for this concept map (human friendly)**

 A short, descriptive, user-friendly title for the concept map.

 This name does not need to be machine-processing friendly and may contain punctuation, white-space, etc. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this concept map. Enables tracking the life-cycle of the content.

 Allows filtering of concept maps that are appropriate for use vs. not.
This is labeled as "Is Modifier" because applications should not use a retired concept map without due consideration. */
    #[serde(rename = "status")]
    pub status: codes::PublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **For testing purposes, not real usage**

 A boolean value to indicate that this concept map is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of concept map that are appropriate for use vs. not. This is labeled as "Is Modifier" because applications should not use an experimental concept map in production. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "experimental")]
    pub experimental: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_experimental")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub experimental_ext: Option<FieldExtension>,
    /** **Date this was last changed**

 The date  (and optionally time) when the concept map was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the concept map changes.

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the concept map. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Name of the publisher (organization or individual)**

 The name of the individual or organization that published the concept map.

 Usually an organization, but may be an individual. The publisher (or steward) of the concept map is the organization or individual primarily responsible for the maintenance and upkeep of the concept map. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the concept map. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisher")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_ext: Option<FieldExtension>,
    /** **Contact details for the publisher**

 Contact details to assist a user in finding and communicating with the publisher.

 May be a web site, an email address, a telephone number, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Natural language description of the concept map**

 A free text natural language description of the concept map from a consumer's perspective.

 The description is not intended to describe the semantics of the concept map. The description should capture its intended use, which is needed for ensuring integrity for its use in models across future changes. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Context the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate concept map instances.

 When multiple useContexts are specified, there is no expectation whether all or any of the contexts apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useContext")]
    pub use_context: Vec<Option<UsageContext>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_useContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_context_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Intended jurisdiction for concept map (if applicable)**

 A legal or geographic region in which the concept map is intended to be used.

 It may be possible for the concept map to be used in jurisdictions other than those for which it was originally designed or intended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **Why this concept map is defined**

 Explaination of why this concept map is needed and why it has been designed as it has.

 This element does not describe the usage of the concept map Instead  it provides traceability of ''why'' the resource is either needed or ''why'' it is defined as it is.  This may be used to point to source materials or specifications that drove the structure of this concept map. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purpose")]
    pub purpose: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_purpose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub purpose_ext: Option<FieldExtension>,
    /** **Use and/or publishing restrictions**

 A copyright statement relating to the concept map and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the concept map.

 null Frequently, the copyright differs between the concept map, and codes that are included. The copyright statement should clearly differentiate between these when required. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyright")]
    pub copyright: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyright")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_ext: Option<FieldExtension>,
    /** **Identifies the source of the concepts which are being mapped**

 The source value set that specifies the concepts that are being mapped.

 Should be a version specific reference. URIs SHOULD be absolute. If there is no source or target value set, the is no specified context for the map. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub source: Option<ConceptMapSource>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_ext: Option<ConceptMapSourceExtension>,
    /** **Provides context to the mappings**

 The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made.

 Should be a version specific reference. URIs SHOULD be absolute. If there is no source or target value set, the is no specified context for the map. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub target: Option<ConceptMapTarget>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub target_ext: Option<ConceptMapTargetExtension>,
    /** **Same source and target systems**

 A group of mappings that all have the same source and target system.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "group")]
    pub group: Vec<Option<ConceptMapGroup>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_group")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub group_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ConceptMapBuilder {
    #[doc = concat!("Finalize building ", "ConceptMap", ".")]
    pub fn build(self) -> Result<ConceptMap, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ConceptMapInner> for ConceptMap {
    fn from(inner: ConceptMapInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ConceptMap {
    type Target = ConceptMapInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ConceptMap {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ConceptMap {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ConceptMapBuilder {
        ConceptMapBuilder::default()
    }
}
impl ConceptMap {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ConceptMap
    }
}
/// Choice of types for the source[x] field in ConceptMap
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConceptMapSource {
    /// Variant accepting the Uri type.
    #[serde(rename = "sourceUri")]
    Uri(String),
    /// Variant accepting the Reference type.
    #[serde(rename = "sourceReference")]
    Reference(Reference),
}
/// Extension value for ConceptMapSource.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConceptMapSourceExtension {
    /// Variant accepting the Uri extension.
    #[serde(rename = "_sourceUri")]
    Uri(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_sourceReference")]
    Reference(FieldExtension),
}
/// Choice of types for the target[x] field in ConceptMap
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConceptMapTarget {
    /// Variant accepting the Uri type.
    #[serde(rename = "targetUri")]
    Uri(String),
    /// Variant accepting the Reference type.
    #[serde(rename = "targetReference")]
    Reference(Reference),
}
/// Extension value for ConceptMapTarget.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConceptMapTargetExtension {
    /// Variant accepting the Uri extension.
    #[serde(rename = "_targetUri")]
    Uri(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_targetReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the group field in ConceptMap
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConceptMapGroupBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConceptMapGroup {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Code System (if value set crosses code systems)**

 An absolute URI that identifies the Code System (if the source is a value set that crosses more than one code system).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "source")]
    pub source: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_source")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_ext: Option<FieldExtension>,
    /** **Specific version of the  code system**

 The specific version of the code system, as determined by the code system authority.

 The specification of a particular code system version may be required for code systems which lack concept permanence. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sourceVersion")]
    pub source_version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sourceVersion")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_version_ext: Option<FieldExtension>,
    /** **System of the target (if necessary)**

 An absolute URI that identifies the code system of the target code (if the target is a value set that cross code systems).

 Target may be omitted if all the targget element equivalence values are 'unmatched'. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "target")]
    pub target: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_target")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub target_ext: Option<FieldExtension>,
    /** **Specific version of the  code system**

 The specific version of the code system, as determined by the code system authority.

 The specification of a particular code system version may be required for code systems which lack concept permanence. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "targetVersion")]
    pub target_version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_targetVersion")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub target_version_ext: Option<FieldExtension>,
    /** **Mappings for a concept from the source set**

 Mappings for an individual concept in the source to one or more concepts in the target.

 Generally, the ideal is that there would only be one mapping for each concept in the source value set, but a given concept may be mapped multiple times with different comments or dependencies. */
    #[serde(rename = "element")]
    pub element: Vec<Option<ConceptMapGroupElement>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_element")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub element_ext: Vec<Option<FieldExtension>>,
    /** **When no match in the mappings**

 What to do when there is no match in the mappings in the group.

 This only applies if the source code is in the system defined for the group. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "unmapped")]
    pub unmapped: Option<ConceptMapGroupUnmapped>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_unmapped")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub unmapped_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ConceptMapGroup {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConceptMapGroupBuilder {
        ConceptMapGroupBuilder::default()
    }
}
/// Sub-fields of the element field in ConceptMapGroup
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConceptMapGroupElementBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConceptMapGroupElement {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Identifies element being mapped**

 Identity (code or path) or the element/item being mapped.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Display for the code**

 The display for the code. The display is only provided to help editors when editing the concept map.

 The display is ignored when processing the map. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "display")]
    pub display: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_display")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub display_ext: Option<FieldExtension>,
    /** **Concept in target system for element**

 A concept from the target value set that this concept maps to.

 Ideally there would only be one map, with equal or equivalent mapping. But multiple maps are allowed for several narrower options, or to assert that other concepts are unmatched. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "target")]
    pub target: Vec<Option<ConceptMapGroupElementTarget>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_target")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub target_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ConceptMapGroupElement {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConceptMapGroupElementBuilder {
        ConceptMapGroupElementBuilder::default()
    }
}
/// Sub-fields of the target field in ConceptMapGroupElement
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConceptMapGroupElementTargetBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConceptMapGroupElementTarget {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Code that identifies the target element**

 Identity (code or path) or the element/item that the map refers to.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Display for the code**

 The display for the code. The display is only provided to help editors when editing the concept map.

 The display is ignored when processing the map. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "display")]
    pub display: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_display")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub display_ext: Option<FieldExtension>,
    /** **[ConceptMapEquivalence](http://hl7.org/fhir/ValueSet/concept-map-equivalence); relatedto | equivalent | equal | wider | subsumes | narrower | specializes | inexact | unmatched | disjoint**

 The equivalence between the source and target concepts (counting for the dependencies and products). The equivalence is read from target to source (e.g. the target is 'wider' than the source).

 This element is labeled as a modifier because it may indicate that a target does not apply. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "equivalence")]
    pub equivalence: Option<codes::ConceptMapEquivalence>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_equivalence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub equivalence_ext: Option<FieldExtension>,
    /** **Description of status/issues in mapping**

 A description of status/issues in mapping that conveys additional information not represented in  the structured data.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "comment")]
    pub comment: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_comment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub comment_ext: Option<FieldExtension>,
    /** **Other elements required for this mapping (from context)**

 A set of additional dependencies for this mapping to hold. This mapping is only applicable if the specified element can be resolved, and it has the specified value.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dependsOn")]
    pub depends_on: Vec<Option<ConceptMapGroupElementTargetDependsOn>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_dependsOn")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub depends_on_ext: Vec<Option<FieldExtension>>,
    /** **Other concepts that this mapping also produces**

 A set of additional outcomes from this mapping to other elements. To properly execute this mapping, the specified element must be mapped to some data element or source that is in context. The mapping may still be useful without a place for the additional data elements, but the equivalence cannot be relied on.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "product")]
    pub product: Vec<Option<ConceptMapGroupElementTargetDependsOn>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_product")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub product_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ConceptMapGroupElementTarget {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConceptMapGroupElementTargetBuilder {
        ConceptMapGroupElementTargetBuilder::default()
    }
}
/// Sub-fields of the dependsOn field in ConceptMapGroupElementTarget
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConceptMapGroupElementTargetDependsOnBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConceptMapGroupElementTargetDependsOn {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Reference to property mapping depends on**

 A reference to an element that holds a coded value that corresponds to a code system property. The idea is that the information model carries an element somwhere that is labeled to correspond with a code system property.

 */
    #[serde(rename = "property")]
    pub property: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_property")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub property_ext: Option<FieldExtension>,
    /** **Code System (if necessary)**

 An absolute URI that identifies the code system of the dependency code (if the source/dependency is a value set that crosses code systems).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "system")]
    pub system: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_system")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub system_ext: Option<FieldExtension>,
    /** **Value of the referenced element**

 Identity (code or path) or the element/item/ValueSet that the map depends on / refers to.

 */
    #[serde(rename = "code")]
    pub code: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Display for the code**

 The display for the code. The display is only provided to help editors when editing the concept map.

 The display is ignored when processing the map. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "display")]
    pub display: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_display")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub display_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ConceptMapGroupElementTargetDependsOn {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConceptMapGroupElementTargetDependsOnBuilder {
        ConceptMapGroupElementTargetDependsOnBuilder::default()
    }
}
/// Sub-fields of the unmapped field in ConceptMapGroup
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConceptMapGroupUnmappedBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConceptMapGroupUnmapped {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ConceptMapGroupUnmappedMode](http://hl7.org/fhir/ValueSet/conceptmap-unmapped-mode); provided | fixed | other-map**

 Defines which action to take if there is no match in the group. One of 3 actions is possible: use the unmapped code (this is useful when doing a mapping between versions, and only a few codes have changed), use a fixed code (a default code), or alternatively, a reference to a different concept map can be provided (by canonical URL).

 */
    #[serde(rename = "mode")]
    pub mode: codes::ConceptMapGroupUnmappedMode,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_mode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub mode_ext: Option<FieldExtension>,
    /** **Fixed code when mode = fixed**

 The fixed code to use when the mode = 'fixed'  - all unmapped codes are mapped to a single fixed code.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Display for the code**

 The display for the code. The display is only provided to help editors when editing the concept map.

 The display is ignored when processing the map. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "display")]
    pub display: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_display")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub display_ext: Option<FieldExtension>,
    /** **Canonical URL for other concept map**

 The canonical URL of the map to use if this map contains no mapping.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "url")]
    pub url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ConceptMapGroupUnmapped {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConceptMapGroupUnmappedBuilder {
        ConceptMapGroupUnmappedBuilder::default()
    }
}
/** Base StructureDefinition for Condition Resource

 **[Condition](http://hl7.org/fhir/StructureDefinition/Condition) v3.0.2**

 Detailed information about conditions, problems or diagnoses

 A clinical condition, problem, diagnosis, or other event, situation, issue, or clinical concept that has risen to a level of concern.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Condition(pub Box<ConditionInner>);
/** Base StructureDefinition for Condition Resource

 **[Condition](http://hl7.org/fhir/StructureDefinition/Condition) v3.0.2**

 Detailed information about conditions, problems or diagnoses

 A clinical condition, problem, diagnosis, or other event, situation, issue, or clinical concept that has risen to a level of concern.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConditionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ConditionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Condition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Condition", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **External Ids for this condition**

 This records identifiers associated with this condition that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[ConditionClinicalStatus](http://hl7.org/fhir/ValueSet/condition-clinical); active | recurrence | inactive | remission | resolved**

 The clinical status of the condition.

 This element is labeled as a modifier because the status contains codes that mark the condition as not currently valid or of concern. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "clinicalStatus")]
    pub clinical_status: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_clinicalStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub clinical_status_ext: Option<FieldExtension>,
    /** **[ConditionVerificationStatus](http://hl7.org/fhir/ValueSet/condition-ver-status); provisional | differential | confirmed | refuted | entered-in-error | unknown**

 The verification status to support the clinical status of the condition.

 verificationStatus is not required.  For example, when a patient has abdominal pain in the ED, there is not likely going to be a verification status.

This element is labeled as a modifier because the status contains the code refuted and entered-in-error that mark the Condition as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "verificationStatus")]
    pub verification_status: Option<codes::ConditionVerificationStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_verificationStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub verification_status_ext: Option<FieldExtension>,
    /** **[ConditionCategory](http://hl7.org/fhir/ValueSet/condition-category); problem-list-item | encounter-diagnosis**

 A category assigned to the condition.

 The categorization is often highly contextual and may appear poorly differentiated or not very useful in other contexts. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub category_ext: Vec<Option<FieldExtension>>,
    /** **[ConditionSeverity](http://hl7.org/fhir/ValueSet/condition-severity); Subjective severity of condition**

 A subjective assessment of the severity of the condition as evaluated by the clinician.

 Coding of the severity with a terminology is preferred, where possible. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "severity")]
    pub severity: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_severity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub severity_ext: Option<FieldExtension>,
    /** **[ConditionKind](http://hl7.org/fhir/ValueSet/condition-code); Identification of the condition, problem or diagnosis**

 Identification of the condition, problem or diagnosis.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **[BodySite](http://hl7.org/fhir/ValueSet/body-site); Anatomical location, if relevant**

 The anatomical location where this condition manifests itself.

 Only used if not implicit in code found in Condition.code. If the use case requires attributes from the BodySite resource (e.g. to identify and track separately) then use the standard extension [body-site-instance](extension-body-site-instance.html).  May be a summary code, or a reference to a very precise definition of the location, or both. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "bodySite")]
    pub body_site: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_bodySite")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub body_site_ext: Vec<Option<FieldExtension>>,
    /** **Who has the condition?**

 Indicates the patient or group who the condition record is associated with.

 */
    #[serde(rename = "subject")]
    pub subject: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Encounter or episode when condition first asserted**

 Encounter during which the condition was first asserted.

 This record indicates the encounter this particular record is associated with.  In the case of a "new" diagnosis reflecting ongoing/revised information about the condition, this might be distinct from the first encounter in which the underlying condition was first "known". */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **Estimated or actual date,  date-time, or age**

 Estimated or actual date or date-time  the condition began, in the opinion of the clinician.

 Age is generally used when the patient reports an age at which the Condition began to occur. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub onset: Option<ConditionOnset>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub onset_ext: Option<ConditionOnsetExtension>,
    /** **If/when in resolution/remission**

 The date or estimated date that the condition resolved or went into remission. This is called "abatement" because of the many overloaded connotations associated with "remission" or "resolution" - Conditions are never really resolved, but they can abate.

 There is no explicit distinction between resolution and remission because in many cases the distinction is not clear. Age is generally used when the patient reports an age at which the Condition abated.  If there is no abatement element, it is unknown whether the condition has resolved or entered remission; applications and users should generally assume that the condition is still valid.  When abatementString exists, it implies the condition is abated. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub abatement: Option<ConditionAbatement>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub abatement_ext: Option<ConditionAbatementExtension>,
    /** **Date record was believed accurate**

 The date on which the existance of the Condition was first asserted or acknowledged.

 The assertedDate represents the date when this particular Condition record was created in the EHR, not the date of the most recent update in terms of when severity, abatement, etc. were specified.  The date of the last record modification can be retrieved from the resource metadata. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "assertedDate")]
    pub asserted_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_assertedDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub asserted_date_ext: Option<FieldExtension>,
    /** **Person who asserts this condition**

 Individual who is making the condition statement.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "asserter")]
    pub asserter: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_asserter")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub asserter_ext: Option<FieldExtension>,
    /** **Stage/grade, usually assessed formally**

 Clinical stage or grade of a condition. May include formal severity assessments.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "stage")]
    pub stage: Option<ConditionStage>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_stage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub stage_ext: Option<FieldExtension>,
    /** **Supporting evidence**

 Supporting Evidence / manifestations that are the basis on which this condition is suspected or confirmed.

 The evidence may be a simple list of coded symptoms/manifestations, or references to observations or formal assessments, or both. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "evidence")]
    pub evidence: Vec<Option<ConditionEvidence>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_evidence")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub evidence_ext: Vec<Option<FieldExtension>>,
    /** **Additional information about the Condition**

 Additional information about the Condition. This is a general notes/comments entry  for description of the Condition, its diagnosis and prognosis.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ConditionBuilder {
    #[doc = concat!("Finalize building ", "Condition", ".")]
    pub fn build(self) -> Result<Condition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ConditionInner> for Condition {
    fn from(inner: ConditionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Condition {
    type Target = ConditionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Condition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Condition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ConditionBuilder {
        ConditionBuilder::default()
    }
}
impl Condition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Condition
    }
}
/// Choice of types for the onset[x] field in Condition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConditionOnset {
    /// Variant accepting the DateTime type.
    #[serde(rename = "onsetDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Age type.
    #[serde(rename = "onsetAge")]
    Age(Age),
    /// Variant accepting the Period type.
    #[serde(rename = "onsetPeriod")]
    Period(Period),
    /// Variant accepting the Range type.
    #[serde(rename = "onsetRange")]
    Range(Range),
    /// Variant accepting the String type.
    #[serde(rename = "onsetString")]
    String(String),
}
/// Extension value for ConditionOnset.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConditionOnsetExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_onsetDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Age extension.
    #[serde(rename = "_onsetAge")]
    Age(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_onsetPeriod")]
    Period(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_onsetRange")]
    Range(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_onsetString")]
    String(FieldExtension),
}
/// Choice of types for the abatement[x] field in Condition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConditionAbatement {
    /// Variant accepting the DateTime type.
    #[serde(rename = "abatementDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Age type.
    #[serde(rename = "abatementAge")]
    Age(Age),
    /// Variant accepting the Boolean type.
    #[serde(rename = "abatementBoolean")]
    Boolean(bool),
    /// Variant accepting the Period type.
    #[serde(rename = "abatementPeriod")]
    Period(Period),
    /// Variant accepting the Range type.
    #[serde(rename = "abatementRange")]
    Range(Range),
    /// Variant accepting the String type.
    #[serde(rename = "abatementString")]
    String(String),
}
/// Extension value for ConditionAbatement.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConditionAbatementExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_abatementDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Age extension.
    #[serde(rename = "_abatementAge")]
    Age(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_abatementBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_abatementPeriod")]
    Period(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_abatementRange")]
    Range(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_abatementString")]
    String(FieldExtension),
}
/// Sub-fields of the stage field in Condition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConditionStageBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConditionStage {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ConditionStage](http://hl7.org/fhir/ValueSet/condition-stage); Simple summary (disease specific)**

 A simple summary of the stage such as "Stage 3". The determination of the stage is disease-specific.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "summary")]
    pub summary: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_summary")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub summary_ext: Option<FieldExtension>,
    /** **Formal record of assessment**

 Reference to a formal record of the evidence on which the staging assessment is based.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "assessment")]
    pub assessment: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_assessment")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub assessment_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ConditionStage {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConditionStageBuilder {
        ConditionStageBuilder::default()
    }
}
/// Sub-fields of the evidence field in Condition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConditionEvidenceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConditionEvidence {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ManifestationOrSymptom](http://hl7.org/fhir/ValueSet/manifestation-or-symptom); Manifestation/symptom**

 A manifestation or symptom that led to the recording of this condition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub code_ext: Vec<Option<FieldExtension>>,
    /** **Supporting information found elsewhere**

 Links to other relevant information, including pathology reports.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "detail")]
    pub detail: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_detail")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub detail_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ConditionEvidence {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConditionEvidenceBuilder {
        ConditionEvidenceBuilder::default()
    }
}
/** Base StructureDefinition for Consent Resource

 **[Consent](http://hl7.org/fhir/StructureDefinition/Consent) v3.0.2**

 A healthcare consumer's policy choices to permits or denies recipients or roles to perform actions for specific purposes and periods of time

 A record of a healthcare consumer’s policy choices, which permits or denies identified recipient(s) or recipient role(s) to perform one or more actions within a given policy context, for specific purposes and periods of time.

 Broadly, there are 3 key areas of consent for patients: Consent around sharing information (aka Privacy Consent Directive - Authorization to Collect, Use, or Disclose information), consent for specific treatment, or kinds of treatment, and general advance care directives. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Consent(pub Box<ConsentInner>);
/** Base StructureDefinition for Consent Resource

 **[Consent](http://hl7.org/fhir/StructureDefinition/Consent) v3.0.2**

 A healthcare consumer's policy choices to permits or denies recipients or roles to perform actions for specific purposes and periods of time

 A record of a healthcare consumer’s policy choices, which permits or denies identified recipient(s) or recipient role(s) to perform one or more actions within a given policy context, for specific purposes and periods of time.

 Broadly, there are 3 key areas of consent for patients: Consent around sharing information (aka Privacy Consent Directive - Authorization to Collect, Use, or Disclose information), consent for specific treatment, or kinds of treatment, and general advance care directives. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConsentBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ConsentInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Consent::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Consent", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Identifier for this record (external references)**

 Unique identifier for this copy of the Consent Statement.

 This identifier is identifies this copy of the consent. Where this identifier is also used elsewhere as the identifier for a consent record (e.g. a CDA consent document) then the consent details are expected to be the same. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **[ConsentState](http://hl7.org/fhir/ValueSet/consent-state-codes); draft | proposed | active | rejected | inactive | entered-in-error**

 Indicates the current state of this consent.

 This element is labeled as a modifier because the status contains the codes rejected and entered-in-error that mark the Consent as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::ConsentState,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[ConsentCategory](http://hl7.org/fhir/ValueSet/consent-category); Classification of the consent statement - for indexing/retrieval**

 A classification of the type of consents found in the statement. This element supports indexing and retrieval of consent statements.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub category_ext: Vec<Option<FieldExtension>>,
    /** **Who the consent applies to**

 The patient/healthcare consumer to whom this consent applies.

 Commonly, the patient the consent pertains to is the author, but for young and old people, it may be some other person. */
    #[serde(rename = "patient")]
    pub patient: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_ext: Option<FieldExtension>,
    /** **Period that this consent applies**

 Relevant time or time-period when this Consent is applicable.

 This can be a subset of the period of the original statement. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
    /** **When this Consent was created or indexed**

 When this  Consent was issued / created / indexed.

 This is not the time of the original consent, but the time that this statement was made or derived. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dateTime")]
    pub date_time: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_dateTime")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_time_ext: Option<FieldExtension>,
    /** **Who is agreeing to the policy and exceptions**

 Either the Grantor, which is the entity responsible for granting the rights listed in a Consent Directive or the Grantee, which is the entity responsible for complying with the Consent Directive, including any obligations or limitations on authorizations and enforcement of prohibitions.

 Commonly, the patient the consent pertains to is the consentor, but particularly for young and old people, it may be some other person - e.g. a legal guardian. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "consentingParty")]
    pub consenting_party: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_consentingParty")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub consenting_party_ext: Vec<Option<FieldExtension>>,
    /** **Who|what controlled by this consent (or group, by role)**

 Who or what is controlled by this consent. Use group to identify a set of actors by some property they share (e.g. 'admitting officers').

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "actor")]
    pub actor: Vec<Option<ConsentActor>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_actor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub actor_ext: Vec<Option<FieldExtension>>,
    /** **[ConsentAction](http://hl7.org/fhir/ValueSet/consent-action); Actions controlled by this consent**

 Actions controlled by this consent.

 Note that this is the direct action (not the grounds for the action covered in the purpose element). At present, the only action in the understood and tested scope of this resource is 'read'. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "action")]
    pub action: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_action")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub action_ext: Vec<Option<FieldExtension>>,
    /** **Custodian of the consent**

 The organization that manages the consent, and the framework within which it is executed.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "organization")]
    pub organization: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_organization")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub organization_ext: Vec<Option<FieldExtension>>,
    /** **Source from which this consent is taken**

 The source on which this consent statement is based. The source might be a scanned original paper form, or a reference to a consent that links back to such a source, a reference to a document repository (e.g. XDS) that stores the original consent document.

 The source can be contained inline (Attachment), referenced directly (Consent), referenced in a consent repository (DocumentReference), or simply by an identifier (Identifier), e.g. a CDA document id. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub source: Option<ConsentSource>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_ext: Option<ConsentSourceExtension>,
    /** **Policies covered by this consent**

 The references to the policies that are included in this consent scope. Policies may be organizational, but are often defined jurisdictionally, or in law.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "policy")]
    pub policy: Vec<Option<ConsentPolicy>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_policy")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub policy_ext: Vec<Option<FieldExtension>>,
    /** **Policy that this consents to**

 A referece to the specific computable policy.

 If the policy reference is not known, the resource cannot be processed. Where the reference is absent, there is no particular policy other than what is expressed directly in the consent resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "policyRule")]
    pub policy_rule: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_policyRule")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub policy_rule_ext: Option<FieldExtension>,
    /** **[SecurityLabels](http://hl7.org/fhir/ValueSet/security-labels); Security Labels that define affected resources**

 A set of security labels that define which resources are controlled by this consent. If more than one label is specified, all resources must have all the specified labels.

 If the consent specifies a security label of "R" then it applies to all resources that are labeled "R" or lower. E.g. for Confidentiality, it's a high water mark. For other kinds of security labels, subsumption logic applies. Not all of the security labels make sense for use in this element (may define a narrower value set?). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "securityLabel")]
    pub security_label: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_securityLabel")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub security_label_ext: Vec<Option<FieldExtension>>,
    /** **[PurposeOfUse](http://hl7.org/fhir/ValueSet/v3-PurposeOfUse); Context of activities for which the agreement is made**

 The context of the activities a user is taking - why the user is accessing the data - that are controlled by this consent.

 This element is for discoverability / documentation, and does not modify or qualify the policy (e.g. the policy itself describes the purposes for which it applies). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purpose")]
    pub purpose: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_purpose")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub purpose_ext: Vec<Option<FieldExtension>>,
    /** **Timeframe for data controlled by this consent**

 Clinical or Operational Relevant period of time that bounds the data controlled by this consent.

 This has a different sense to the Consent.period - that is when the consent agreement holds. This is the time period of the data that is controlled by the agreement. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dataPeriod")]
    pub data_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_dataPeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub data_period_ext: Option<FieldExtension>,
    /** **Data controlled by this consent**

 The resources controlled by this consent, if specific resources are referenced.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "data")]
    pub data: Vec<Option<ConsentData>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_data")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub data_ext: Vec<Option<FieldExtension>>,
    /** **Additional rule -  addition or removal of permissions**

 An exception to the base policy of this consent. An exception can be an addition or removal of access permissions.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "except")]
    pub except: Vec<Option<ConsentExcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_except")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub except_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ConsentBuilder {
    #[doc = concat!("Finalize building ", "Consent", ".")]
    pub fn build(self) -> Result<Consent, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ConsentInner> for Consent {
    fn from(inner: ConsentInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Consent {
    type Target = ConsentInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Consent {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Consent {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ConsentBuilder {
        ConsentBuilder::default()
    }
}
impl Consent {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Consent
    }
}
/// Sub-fields of the actor field in Consent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConsentActorBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConsentActor {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ConsentActorRole](http://hl7.org/fhir/ValueSet/security-role-type); How the actor is involved**

 How the individual is involved in the resources content that is described in the consent.

 */
    #[serde(rename = "role")]
    pub role: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_role")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub role_ext: Option<FieldExtension>,
    /** **Resource for the actor (or group, by role)**

 The resource that identifies the actor. To identify a actors by type, use group to identify a set of actors by some property they share (e.g. 'admitting officers').

 */
    #[serde(rename = "reference")]
    pub reference: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reference_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ConsentActor {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConsentActorBuilder {
        ConsentActorBuilder::default()
    }
}
/// Choice of types for the source[x] field in Consent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConsentSource {
    /// Variant accepting the Attachment type.
    #[serde(rename = "sourceAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Identifier type.
    #[serde(rename = "sourceIdentifier")]
    Identifier(Identifier),
    /// Variant accepting the Reference type.
    #[serde(rename = "sourceReference")]
    Reference(Reference),
}
/// Extension value for ConsentSource.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ConsentSourceExtension {
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_sourceAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the Identifier extension.
    #[serde(rename = "_sourceIdentifier")]
    Identifier(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_sourceReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the policy field in Consent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConsentPolicyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConsentPolicy {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Enforcement source for policy**

 Entity or Organization having regulatory jurisdiction or accountability for  enforcing policies pertaining to Consent Directives.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authority")]
    pub authority: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_authority")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub authority_ext: Option<FieldExtension>,
    /** **Specific policy covered by this consent**

 The references to the policies that are included in this consent scope. Policies may be organizational, but are often defined jurisdictionally, or in law.

 This element is for discoverability / documentation, and does not modify or qualify the policy rules. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "uri")]
    pub uri: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_uri")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub uri_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ConsentPolicy {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConsentPolicyBuilder {
        ConsentPolicyBuilder::default()
    }
}
/// Sub-fields of the data field in Consent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConsentDataBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConsentData {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ConsentDataMeaning](http://hl7.org/fhir/ValueSet/consent-data-meaning); instance | related | dependents | authoredby**

 How the resource reference is interpreted when testing consent restrictions.

 */
    #[serde(rename = "meaning")]
    pub meaning: codes::ConsentDataMeaning,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_meaning")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub meaning_ext: Option<FieldExtension>,
    /** **The actual data reference**

 A reference to a specific resource that defines which resources are covered by this consent.

 */
    #[serde(rename = "reference")]
    pub reference: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reference_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ConsentData {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConsentDataBuilder {
        ConsentDataBuilder::default()
    }
}
/// Sub-fields of the except field in Consent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConsentExceptBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConsentExcept {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ConsentExceptType](http://hl7.org/fhir/ValueSet/consent-except-type); deny | permit**

 Action  to take - permit or deny - when the exception conditions are met.

 */
    #[serde(rename = "type")]
    pub r#type: codes::ConsentExceptType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Timeframe for this exception**

 The timeframe in this exception is valid.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
    /** **Who|what controlled by this exception (or group, by role)**

 Who or what is controlled by this Exception. Use group to identify a set of actors by some property they share (e.g. 'admitting officers').

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "actor")]
    pub actor: Vec<Option<ConsentExceptActor>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_actor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub actor_ext: Vec<Option<FieldExtension>>,
    /** **[ConsentAction](http://hl7.org/fhir/ValueSet/consent-action); Actions controlled by this exception**

 Actions controlled by this Exception.

 Note that this is the direct action (not the grounds for the action covered in the purpose element). At present, the only action in the understood and tested scope of this resource is 'read'. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "action")]
    pub action: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_action")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub action_ext: Vec<Option<FieldExtension>>,
    /** **[SecurityLabels](http://hl7.org/fhir/ValueSet/security-labels); Security Labels that define affected resources**

 A set of security labels that define which resources are controlled by this exception. If more than one label is specified, all resources must have all the specified labels.

 If the consent specifies a security label of "R" then it applies to all resources that are labeled "R" or lower. E.g. for Confidentiality, it's a high water mark. For other kinds of security labels, subsumption logic applies. Not all of the security labels make sense for use in this element (may define a narrower value set?). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "securityLabel")]
    pub security_label: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_securityLabel")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub security_label_ext: Vec<Option<FieldExtension>>,
    /** **[PurposeOfUse](http://hl7.org/fhir/ValueSet/v3-PurposeOfUse); Context of activities covered by this exception**

 The context of the activities a user is taking - why the user is accessing the data - that are controlled by this exception.

 E.g. if the purpose is 'research', then the operational context must be research, in order for the consent to apply. Not all of the security labels make sense for use in this element (may define a narrower value set?). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purpose")]
    pub purpose: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_purpose")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub purpose_ext: Vec<Option<FieldExtension>>,
    /** **[ConsentContentClass](http://hl7.org/fhir/ValueSet/consent-content-class); e.g. Resource Type, Profile, or CDA etc**

 The class of information covered by this exception. The type can be a FHIR resource type, a profile on a type, or a CDA document, or some other type that indicates what sort of information the consent relates to.

 Multiple types are or'ed together. The intention of the contentType element is that the codes refer to profiles or document types defined in a standard or an implementation guide somewhere. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "class")]
    pub class: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_class")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub class_ext: Vec<Option<FieldExtension>>,
    /** **[ConsentContentCode](http://hl7.org/fhir/ValueSet/consent-content-code); e.g. LOINC or SNOMED CT code, etc in the content**

 If this code is found in an instance, then the exception applies.

 Typical use of this is a Document code with class = CDA. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub code_ext: Vec<Option<FieldExtension>>,
    /** **Timeframe for data controlled by this exception**

 Clinical or Operational Relevant period of time that bounds the data controlled by this exception.

 This has a different sense to the Consent.period - that is when the consent agreement holds. This is the time period of the data that is controlled by the agreement. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dataPeriod")]
    pub data_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_dataPeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub data_period_ext: Option<FieldExtension>,
    /** **Data controlled by this exception**

 The resources controlled by this exception, if specific resources are referenced.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "data")]
    pub data: Vec<Option<ConsentExceptData>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_data")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub data_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ConsentExcept {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConsentExceptBuilder {
        ConsentExceptBuilder::default()
    }
}
/// Sub-fields of the actor field in ConsentExcept
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConsentExceptActorBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConsentExceptActor {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ConsentActorRole](http://hl7.org/fhir/ValueSet/security-role-type); How the actor is involved**

 How the individual is involved in the resources content that is described in the exception.

 */
    #[serde(rename = "role")]
    pub role: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_role")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub role_ext: Option<FieldExtension>,
    /** **Resource for the actor (or group, by role)**

 The resource that identifies the actor. To identify a actors by type, use group to identify a set of actors by some property they share (e.g. 'admitting officers').

 */
    #[serde(rename = "reference")]
    pub reference: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reference_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ConsentExceptActor {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConsentExceptActorBuilder {
        ConsentExceptActorBuilder::default()
    }
}
/// Sub-fields of the data field in ConsentExcept
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ConsentExceptDataBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ConsentExceptData {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ConsentDataMeaning](http://hl7.org/fhir/ValueSet/consent-data-meaning); instance | related | dependents | authoredby**

 How the resource reference is interpreted when testing consent restrictions.

 */
    #[serde(rename = "meaning")]
    pub meaning: codes::ConsentDataMeaning,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_meaning")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub meaning_ext: Option<FieldExtension>,
    /** **The actual data reference**

 A reference to a specific resource that defines which resources are covered by this consent.

 */
    #[serde(rename = "reference")]
    pub reference: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reference_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ConsentExceptData {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ConsentExceptDataBuilder {
        ConsentExceptDataBuilder::default()
    }
}
/** Base StructureDefinition for Contract Resource

 **[Contract](http://hl7.org/fhir/StructureDefinition/Contract) v3.0.2**

 Legal Agreement

 A formal agreement between parties regarding the conduct of business, exchange of information or other matters.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Contract(pub Box<ContractInner>);
/** Base StructureDefinition for Contract Resource

 **[Contract](http://hl7.org/fhir/StructureDefinition/Contract) v3.0.2**

 Legal Agreement

 A formal agreement between parties regarding the conduct of business, exchange of information or other matters.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ContractBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ContractInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Contract::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Contract", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Contract number**

 Unique identifier for this Contract.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **[ContractStatus](http://hl7.org/fhir/ValueSet/contract-status); amended | appended | cancelled | disputed | entered-in-error | executable | executed | negotiable | offered | policy | rejected | renewed | revoked | resolved | terminated**

 The status of the resource instance.

 This element is labeled as a modifier because the status contains codes that mark the contract as not currently valid or active. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **When this Contract was issued**

 When this  Contract was issued.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "issued")]
    pub issued: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_issued")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub issued_ext: Option<FieldExtension>,
    /** **Effective time**

 Relevant time or time-period when this Contract is applicable.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "applies")]
    pub applies: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_applies")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub applies_ext: Option<FieldExtension>,
    /** **Contract Target Entity**

 The target entity impacted by or of interest to parties to the agreement.

 The Contract.subject is an entity that has some role with respect to the Contract.topic and Contract.topic.term, which is of focal interest to the parties to the contract and likely impacted in a significant way by the Contract.action/Contract.action.reason and the Contract.term.action/Contract.action.reason.
In many cases, the Contract.subject is a Contract.signer if the subject is an adult; has a legal interest in the contract; and incompetent to participate in the contract agreement. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub subject_ext: Vec<Option<FieldExtension>>,
    /** **Context of the Contract**

 The matter of concern in the context of this agreement.

 The Contract.topic may be an application for or offer of a policy or service (e.g., uri to a consent directive form or a health insurance policy), which becomes the Contract once accepted by both the grantor and grantee.
The Contract Resource may function simply as the computable representation of the executed contract, which may be the attached to the Contract Resource as the “binding” or as the “friendly” electronic form.  For example, a Contract Resource may be automatically populated with the values expressed in a related QuestionnaireResponse.
However, the Contract Resource may be considered the legally binding contract if it is the only “executed” form of this contract, and includes the signatures as *The Contract Resource may function as the computable representation of an application or offer in a pre-executed Contract if the grantor has not entered any values.  In this case, it is populated with values in a “legal” form of the application or offer or by the values in an associated Questionnaire.  If the grantor has filled in the legal form or the associated Questionnaire Response, then these values are used to populate a pre-executed Contract Resource.
If the Contract.topic is considered an application or offer, then the policy is often required to be attached as the “legal” basis for the application to ensure “informed consent” to the contract, and that any discrepancy between the application and the policy are interpreted against the policy.  Implementers should check organizational and jurisdictional policies to determine the relationship among multiple representations of a contract pre- and post-execution. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "topic")]
    pub topic: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_topic")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub topic_ext: Vec<Option<FieldExtension>>,
    /** **Authority under which this Contract has standing**

 A formally or informally recognized grouping of people, principals, organizations, or jurisdictions formed for the purpose of achieving some form of collective action such as the promulgation, administration and enforcement of contracts and policies.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authority")]
    pub authority: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_authority")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub authority_ext: Vec<Option<FieldExtension>>,
    /** **Domain in which this Contract applies**

 Recognized governance framework or system operating with a circumscribed scope in accordance with specified principles, policies, processes or procedures for managing rights, actions, or behaviors of parties or principals relative to resources.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "domain")]
    pub domain: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_domain")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub domain_ext: Vec<Option<FieldExtension>>,
    /** **[ContractType](http://hl7.org/fhir/ValueSet/contract-type); Type or form**

 Type of Contract such as an insurance policy, real estate contract, a will, power of attorny, Privacy or Security policy , trust framework agreement, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[ContractSubtype](http://hl7.org/fhir/ValueSet/contract-subtype); Subtype within the context of type**

 More specific type or specialization of an overarching or more general contract such as auto insurance, home owner  insurance, prenupial agreement, Advanced-Directive, or privacy consent.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subType")]
    pub sub_type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub sub_type_ext: Vec<Option<FieldExtension>>,
    /** **[ContractAction](http://hl7.org/fhir/ValueSet/contract-action); Action stipulated by this Contract**

 Action stipulated by this Contract.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "action")]
    pub action: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_action")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub action_ext: Vec<Option<FieldExtension>>,
    /** **[ContractActionReason](http://hl7.org/fhir/ValueSet/v3-PurposeOfUse); Rationale for the stiplulated action**

 Reason for action stipulated by this Contract.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "actionReason")]
    pub action_reason: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_actionReason")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub action_reason_ext: Vec<Option<FieldExtension>>,
    /** **[ContractDecisionType](http://hl7.org/fhir/ValueSet/v3-ActConsentDirective); Decision by Grantor**

 The type of decision made by a grantor with respect to an offer made by a grantee.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "decisionType")]
    pub decision_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_decisionType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub decision_type_ext: Option<FieldExtension>,
    /** **[ContractContentDerivative](http://hl7.org/fhir/ValueSet/contract-content-derivative); Content derived from the basal information**

 The minimal content derived from the basal information source at a specific stage in its lifecycle.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contentDerivative")]
    pub content_derivative: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_contentDerivative")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub content_derivative_ext: Option<FieldExtension>,
    /** **[SecurityLabels](http://hl7.org/fhir/ValueSet/security-labels); Security Labels that define affected resources**

 A set of security labels that define which resources are controlled by this consent. If more than one label is specified, all resources must have all the specified labels.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "securityLabel")]
    pub security_label: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_securityLabel")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub security_label_ext: Vec<Option<FieldExtension>>,
    /** **Entity being ascribed responsibility**

 An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.

 Several agents may be associated (i.e. has some responsibility for an activity) with an activity and vice-versa.
For example, in cases of actions initiated by one user for other users, or in events that involve more than one user, hardware device, software, or system process. However, only one user may be the initiator/requestor for the event. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "agent")]
    pub agent: Vec<Option<ContractAgent>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_agent")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub agent_ext: Vec<Option<FieldExtension>>,
    /** **Contract Signatory**

 Parties with legal standing in the Contract, including the principal parties, the grantor(s) and grantee(s), which are any person or organization bound by the contract, and any ancillary parties, which facilitate the execution of the contract such as a notary or witness.

 Signers who are principal parties to the contract are bound by the Contract.activity related to the Contract.topic, and the Contract.term(s), which either extend or restrict the overall action on the topic by, for example, stipulating specific policies or obligations constraining actions, action reason, or agents with respect to some or all of the topic.
For example, specifying how policies or obligations shall constrain actions and action reasons permitted or denied on all or a subset of the Contract.topic (e.g., all or a portion of property being transferred by the contract), agents (e.g., who can resell, assign interests, or alter the property being transferred by the contract), actions, and action reasons; or with respect to Contract.terms, stipulating, extending, or limiting the Contract.period of applicability or valuation of items under consideration. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "signer")]
    pub signer: Vec<Option<ContractSigner>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_signer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub signer_ext: Vec<Option<FieldExtension>>,
    /** **Contract Valued Item List**

 Contract Valued Item List.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "valuedItem")]
    pub valued_item: Vec<Option<ContractValuedItem>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_valuedItem")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub valued_item_ext: Vec<Option<FieldExtension>>,
    /** **Contract Term List**

 One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "term")]
    pub term: Vec<Option<ContractTerm>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_term")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub term_ext: Vec<Option<FieldExtension>>,
    /** **Binding Contract**

 Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the "source of truth" and which would be the basis for legal action related to enforcement of this Contract.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub binding: Option<ContractBinding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub binding_ext: Option<ContractBindingExtension>,
    /** **Contract Friendly Language**

 The "patient friendly language" versionof the Contract in whole or in parts. "Patient friendly language" means the representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "friendly")]
    pub friendly: Vec<Option<ContractFriendly>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_friendly")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub friendly_ext: Vec<Option<FieldExtension>>,
    /** **Contract Legal Language**

 List of Legal expressions or representations of this Contract.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "legal")]
    pub legal: Vec<Option<ContractLegal>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_legal")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub legal_ext: Vec<Option<FieldExtension>>,
    /** **Computable Contract Language**

 List of Computable Policy Rule Language Representations of this Contract.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "rule")]
    pub rule: Vec<Option<ContractRule>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_rule")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub rule_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ContractBuilder {
    #[doc = concat!("Finalize building ", "Contract", ".")]
    pub fn build(self) -> Result<Contract, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ContractInner> for Contract {
    fn from(inner: ContractInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Contract {
    type Target = ContractInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Contract {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Contract {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ContractBuilder {
        ContractBuilder::default()
    }
}
impl Contract {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Contract
    }
}
/// Sub-fields of the agent field in Contract
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ContractAgentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ContractAgent {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Contract Agent Type**

 Who or what parties are assigned roles in this Contract.

 */
    #[serde(rename = "actor")]
    pub actor: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_actor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub actor_ext: Option<FieldExtension>,
    /** **[ContractActorRole](http://hl7.org/fhir/ValueSet/contract-actorrole); Role type of the agent**

 Role type of agent assigned roles in this Contract.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "role")]
    pub role: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_role")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub role_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ContractAgent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ContractAgentBuilder {
        ContractAgentBuilder::default()
    }
}
/// Sub-fields of the signer field in Contract
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ContractSignerBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ContractSigner {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ContractSignerType](http://hl7.org/fhir/ValueSet/contract-signer-type); Contract Signatory Role**

 Role of this Contract signer, e.g. notary, grantee.

 */
    #[serde(rename = "type")]
    pub r#type: Coding,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Contract Signatory Party**

 Party which is a signator to this Contract.

 */
    #[serde(rename = "party")]
    pub party: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_party")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub party_ext: Option<FieldExtension>,
    /** **Contract Documentation Signature**

 Legally binding Contract DSIG signature contents in Base64.

 */
    #[serde(rename = "signature")]
    pub signature: Vec<Option<Signature>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_signature")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub signature_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ContractSigner {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ContractSignerBuilder {
        ContractSignerBuilder::default()
    }
}
/// Sub-fields of the valuedItem field in Contract
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ContractValuedItemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ContractValuedItem {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Contract Valued Item Type**

 Specific type of Contract Valued Item that may be priced.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub entity: Option<ContractValuedItemEntity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub entity_ext: Option<ContractValuedItemEntityExtension>,
    /** **Contract Valued Item Number**

 Identifies a Contract Valued Item instance.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **Contract Valued Item Effective Tiem**

 Indicates the time during which this Contract ValuedItem information is effective.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "effectiveTime")]
    pub effective_time: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_effectiveTime")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub effective_time_ext: Option<FieldExtension>,
    /** **Count of Contract Valued Items**

 Specifies the units by which the Contract Valued Item is measured or counted, and quantifies the countable or measurable Contract Valued Item instances.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_quantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<FieldExtension>,
    /** **Contract Valued Item fee, charge, or cost**

 A Contract Valued Item unit valuation measure.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "unitPrice")]
    pub unit_price: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_unitPrice")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub unit_price_ext: Option<FieldExtension>,
    /** **Contract Valued Item Price Scaling Factor**

 A real number that represents a multiplier used in determining the overall value of the Contract Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "factor")]
    pub factor: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_factor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub factor_ext: Option<FieldExtension>,
    /** **Contract Valued Item Difficulty Scaling Factor**

 An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Valued Item delivered. The concept of Points allows for assignment of point values for a Contract Valued Item, such that a monetary amount can be assigned to each point.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "points")]
    pub points: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_points")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub points_ext: Option<FieldExtension>,
    /** **Total Contract Valued Item Value**

 Expresses the product of the Contract Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "net")]
    pub net: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_net")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub net_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ContractValuedItem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ContractValuedItemBuilder {
        ContractValuedItemBuilder::default()
    }
}
/// Choice of types for the entity[x] field in ContractValuedItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractValuedItemEntity {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "entityCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "entityReference")]
    Reference(Reference),
}
/// Extension value for ContractValuedItemEntity.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractValuedItemEntityExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_entityCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_entityReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the term field in Contract
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ContractTermBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ContractTerm {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Contract Term Number**

 Unique identifier for this particular Contract Provision.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **Contract Term Issue Date Time**

 When this Contract Provision was issued.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "issued")]
    pub issued: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_issued")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub issued_ext: Option<FieldExtension>,
    /** **Contract Term Effective Time**

 Relevant time or time-period when this Contract Provision is applicable.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "applies")]
    pub applies: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_applies")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub applies_ext: Option<FieldExtension>,
    /** **[ContractTermType](http://hl7.org/fhir/ValueSet/contract-term-type); Contract Term Type or Form**

 Type of Contract Provision such as specific requirements, purposes for actions, obligations, prohibitions, e.g. life time maximum benefit.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[ContractTermSubType](http://hl7.org/fhir/ValueSet/contract-term-subtype); Contract Term Type specific classification**

 Subtype of this Contract Provision, e.g. life time maximum payment for a contract term for specific valued item, e.g. disability payment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subType")]
    pub sub_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sub_type_ext: Option<FieldExtension>,
    /** **Context of the Contract term**

 The matter of concern in the context of this provision of the agrement.

 The Contract.term.topic, as a Contract Resource subpart, is handled in the same manner as the Contract Resource as discussed above. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "topic")]
    pub topic: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_topic")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub topic_ext: Vec<Option<FieldExtension>>,
    /** **[ContractAction](http://hl7.org/fhir/ValueSet/contract-action); Contract Term Activity**

 Action stipulated by this Contract Provision.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "action")]
    pub action: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_action")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub action_ext: Vec<Option<FieldExtension>>,
    /** **[ContractActionReason](http://hl7.org/fhir/ValueSet/v3-PurposeOfUse); Purpose for the Contract Term Action**

 Reason or purpose for the action stipulated by this Contract Provision.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "actionReason")]
    pub action_reason: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_actionReason")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub action_reason_ext: Vec<Option<FieldExtension>>,
    /** **[SecurityLabels](http://hl7.org/fhir/ValueSet/security-labels); Security Labels that define affected terms**

 A set of security labels that define which terms are controlled by this condition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "securityLabel")]
    pub security_label: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_securityLabel")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub security_label_ext: Vec<Option<FieldExtension>>,
    /** **Contract Term Agent List**

 An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity taking place.

 Several agents may be associated (i.e. has some responsibility for an activity) with an activity and vice-versa.
For example, in cases of actions initiated by one user for other users, or in events that involve more than one user, hardware device, software, or system process. However, only one user may be the initiator/requestor for the event. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "agent")]
    pub agent: Vec<Option<ContractTermAgent>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_agent")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub agent_ext: Vec<Option<FieldExtension>>,
    /** **Human readable Contract term text**

 Human readable form of this Contract Provision.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_text")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub text_ext: Option<FieldExtension>,
    /** **Contract Term Valued Item List**

 Contract Provision Valued Item List.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "valuedItem")]
    pub valued_item: Vec<Option<ContractTermValuedItem>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_valuedItem")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub valued_item_ext: Vec<Option<FieldExtension>>,
    /** **Nested Contract Term Group**

 Nested group of Contract Provisions.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "group")]
    pub group: Vec<Option<ContractTerm>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_group")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub group_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ContractTerm {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ContractTermBuilder {
        ContractTermBuilder::default()
    }
}
/// Sub-fields of the agent field in ContractTerm
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ContractTermAgentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ContractTermAgent {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Contract Term Agent Subject**

 The agent assigned a role in this Contract Provision.

 */
    #[serde(rename = "actor")]
    pub actor: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_actor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub actor_ext: Option<FieldExtension>,
    /** **[ContractActorRole](http://hl7.org/fhir/ValueSet/contract-actorrole); Type of the Contract Term Agent**

 Role played by the agent assigned this role in the execution of this Contract Provision.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "role")]
    pub role: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_role")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub role_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ContractTermAgent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ContractTermAgentBuilder {
        ContractTermAgentBuilder::default()
    }
}
/// Sub-fields of the valuedItem field in ContractTerm
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ContractTermValuedItemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ContractTermValuedItem {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Contract Term Valued Item Type**

 Specific type of Contract Provision Valued Item that may be priced.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub entity: Option<ContractTermValuedItemEntity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub entity_ext: Option<ContractTermValuedItemEntityExtension>,
    /** **Contract Term Valued Item Number**

 Identifies a Contract Provision Valued Item instance.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **Contract Term Valued Item Effective Tiem**

 Indicates the time during which this Contract Term ValuedItem information is effective.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "effectiveTime")]
    pub effective_time: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_effectiveTime")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub effective_time_ext: Option<FieldExtension>,
    /** **Contract Term Valued Item Count**

 Specifies the units by which the Contract Provision Valued Item is measured or counted, and quantifies the countable or measurable Contract Term Valued Item instances.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_quantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<FieldExtension>,
    /** **Contract Term Valued Item fee, charge, or cost**

 A Contract Provision Valued Item unit valuation measure.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "unitPrice")]
    pub unit_price: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_unitPrice")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub unit_price_ext: Option<FieldExtension>,
    /** **Contract Term Valued Item Price Scaling Factor**

 A real number that represents a multiplier used in determining the overall value of the Contract Provision Valued Item delivered. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "factor")]
    pub factor: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_factor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub factor_ext: Option<FieldExtension>,
    /** **Contract Term Valued Item Difficulty Scaling Factor**

 An amount that expresses the weighting (based on difficulty, cost and/or resource intensiveness) associated with the Contract Provision Valued Item delivered. The concept of Points allows for assignment of point values for a Contract ProvisionValued Item, such that a monetary amount can be assigned to each point.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "points")]
    pub points: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_points")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub points_ext: Option<FieldExtension>,
    /** **Total Contract Term Valued Item Value**

 Expresses the product of the Contract Provision Valued Item unitQuantity and the unitPriceAmt. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "net")]
    pub net: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_net")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub net_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ContractTermValuedItem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ContractTermValuedItemBuilder {
        ContractTermValuedItemBuilder::default()
    }
}
/// Choice of types for the entity[x] field in ContractTermValuedItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractTermValuedItemEntity {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "entityCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "entityReference")]
    Reference(Reference),
}
/// Extension value for ContractTermValuedItemEntity.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractTermValuedItemEntityExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_entityCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_entityReference")]
    Reference(FieldExtension),
}
/// Choice of types for the binding[x] field in Contract
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractBinding {
    /// Variant accepting the Attachment type.
    #[serde(rename = "bindingAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Reference type.
    #[serde(rename = "bindingReference")]
    Reference(Reference),
}
/// Extension value for ContractBinding.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractBindingExtension {
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_bindingAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_bindingReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the friendly field in Contract
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ContractFriendlyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ContractFriendly {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Easily comprehended representation of this Contract**

 Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.

 */
    #[serde(flatten)]
    pub content: ContractFriendlyContent,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub content_ext: Option<ContractFriendlyContentExtension>,
}
#[cfg(feature = "builders")]
impl ContractFriendly {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ContractFriendlyBuilder {
        ContractFriendlyBuilder::default()
    }
}
/// Choice of types for the content[x] field in ContractFriendly
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractFriendlyContent {
    /// Variant accepting the Attachment type.
    #[serde(rename = "contentAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Reference type.
    #[serde(rename = "contentReference")]
    Reference(Reference),
}
/// Extension value for ContractFriendlyContent.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractFriendlyContentExtension {
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_contentAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_contentReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the legal field in Contract
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ContractLegalBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ContractLegal {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Contract Legal Text**

 Contract legal text in human renderable form.

 */
    #[serde(flatten)]
    pub content: ContractLegalContent,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub content_ext: Option<ContractLegalContentExtension>,
}
#[cfg(feature = "builders")]
impl ContractLegal {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ContractLegalBuilder {
        ContractLegalBuilder::default()
    }
}
/// Choice of types for the content[x] field in ContractLegal
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractLegalContent {
    /// Variant accepting the Attachment type.
    #[serde(rename = "contentAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Reference type.
    #[serde(rename = "contentReference")]
    Reference(Reference),
}
/// Extension value for ContractLegalContent.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractLegalContentExtension {
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_contentAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_contentReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the rule field in Contract
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ContractRuleBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ContractRule {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Computable Contract Rules**

 Computable Contract conveyed using a policy rule language (e.g. XACML, DKAL, SecPal).

 */
    #[serde(flatten)]
    pub content: ContractRuleContent,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub content_ext: Option<ContractRuleContentExtension>,
}
#[cfg(feature = "builders")]
impl ContractRule {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ContractRuleBuilder {
        ContractRuleBuilder::default()
    }
}
/// Choice of types for the content[x] field in ContractRule
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractRuleContent {
    /// Variant accepting the Attachment type.
    #[serde(rename = "contentAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Reference type.
    #[serde(rename = "contentReference")]
    Reference(Reference),
}
/// Extension value for ContractRuleContent.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ContractRuleContentExtension {
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_contentAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_contentReference")]
    Reference(FieldExtension),
}
/** Base StructureDefinition for Coverage Resource

 **[Coverage](http://hl7.org/fhir/StructureDefinition/Coverage) v3.0.2**

 Insurance or medical plan or a payment agreement

 Financial instrument which may be used to reimburse or pay for health care products and services.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Coverage(pub Box<CoverageInner>);
/** Base StructureDefinition for Coverage Resource

 **[Coverage](http://hl7.org/fhir/StructureDefinition/Coverage) v3.0.2**

 Insurance or medical plan or a payment agreement

 Financial instrument which may be used to reimburse or pay for health care products and services.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CoverageBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct CoverageInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Coverage::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Coverage", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **The primary coverage ID**

 The main (and possibly only) identifier for the coverage - often referred to as a Member Id, Certificate number, Personal Health Number or Case ID. May be constructed as the concatination of the Coverage.SubscriberID and the Coverage.dependant.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[CoverageStatus](http://hl7.org/fhir/ValueSet/fm-status); active | cancelled | draft | entered-in-error**

 The status of the resource instance.

 This element is labeled as a modifier because the status contains the code entered-in-error that marks the coverage as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[CoverageType](http://hl7.org/fhir/ValueSet/coverage-type); Type of coverage such as medical or accident**

 The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health or payment by an individual or organization.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Owner of the policy**

 The party who 'owns' the insurance policy,  may be an individual, corporation or the subscriber's employer.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "policyHolder")]
    pub policy_holder: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_policyHolder")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub policy_holder_ext: Option<FieldExtension>,
    /** **Subscriber to the policy**

 The party who has signed-up for or 'owns' the contractual relationship to the policy or to whom the benefit of the policy for services rendered to them or their family is due.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subscriber")]
    pub subscriber: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subscriber")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subscriber_ext: Option<FieldExtension>,
    /** **ID assigned to the Subscriber**

 The insurer assigned ID for the Subscriber.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subscriberId")]
    pub subscriber_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subscriberId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subscriber_id_ext: Option<FieldExtension>,
    /** **Plan Beneficiary**

 The party who benefits from the insurance coverage., the patient when services are provided.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "beneficiary")]
    pub beneficiary: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_beneficiary")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub beneficiary_ext: Option<FieldExtension>,
    /** **[Relationship](http://hl7.org/fhir/ValueSet/policyholder-relationship); Beneficiary relationship to the Subscriber**

 The relationship of beneficiary (patient) to the subscriber.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relationship")]
    pub relationship: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_relationship")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub relationship_ext: Option<FieldExtension>,
    /** **Coverage start and end dates**

 Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
    /** **Identifier for the plan or agreement issuer**

 The program or plan underwriter or payor including both insurance and non-insurance agreements, such as patient-pay agreements. May provide multiple identifiers such as insurance company identifier or business identifier (BIN number).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "payor")]
    pub payor: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_payor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub payor_ext: Vec<Option<FieldExtension>>,
    /** **Additional coverage classifications**

 A suite of underwrite specific classifiers, for example may be used to identify a class of coverage or employer group, Policy, Plan.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "grouping")]
    pub grouping: Option<CoverageGrouping>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_grouping")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub grouping_ext: Option<FieldExtension>,
    /** **Dependent number**

 A unique identifier for a dependent under the coverage.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dependent")]
    pub dependent: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_dependent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub dependent_ext: Option<FieldExtension>,
    /** **The plan instance or sequence counter**

 An optional counter for a particular instance of the identified coverage which increments upon each renewal.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sequence")]
    pub sequence: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_ext: Option<FieldExtension>,
    /** **Relative order of the coverage**

 The order of applicability of this coverage relative to other coverages which are currently inforce. Note, there may be gaps in the numbering and this does not imply primary, secondard etc. as the specific positioning of coverages depends upon the episode of care.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "order")]
    pub order: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_order")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub order_ext: Option<FieldExtension>,
    /** **Insurer network**

 The insurer-specific identifier for the insurer-defined network of providers to which the beneficiary may seek treatment which will be covered at the 'in-network' rate, otherwise 'out of network' terms and conditions apply.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "network")]
    pub network: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_network")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub network_ext: Option<FieldExtension>,
    /** **Contract details**

 The policy(s) which constitute this insurance coverage.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contract")]
    pub contract: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contract")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contract_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl CoverageBuilder {
    #[doc = concat!("Finalize building ", "Coverage", ".")]
    pub fn build(self) -> Result<Coverage, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<CoverageInner> for Coverage {
    fn from(inner: CoverageInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Coverage {
    type Target = CoverageInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Coverage {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Coverage {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> CoverageBuilder {
        CoverageBuilder::default()
    }
}
impl Coverage {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Coverage
    }
}
/// Sub-fields of the grouping field in Coverage
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "CoverageGroupingBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct CoverageGrouping {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **An identifier for the group**

 Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify an employer group. May also be referred to as a Policy or Group ID.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "group")]
    pub group: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_group")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub group_ext: Option<FieldExtension>,
    /** **Display text for an identifier for the group**

 A short description for the group.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "groupDisplay")]
    pub group_display: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_groupDisplay")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub group_display_ext: Option<FieldExtension>,
    /** **An identifier for the subsection of the group**

 Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify a subset of an employer group.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subGroup")]
    pub sub_group: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subGroup")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sub_group_ext: Option<FieldExtension>,
    /** **Display text for the subsection of the group**

 A short description for the subgroup.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subGroupDisplay")]
    pub sub_group_display: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subGroupDisplay")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sub_group_display_ext: Option<FieldExtension>,
    /** **An identifier for the plan**

 Identifies a style or collective of coverage issued by the underwriter, for example may be used to identify a collection of benefits provided to employees. May be referred to as a Section or Division ID.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "plan")]
    pub plan: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_plan")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub plan_ext: Option<FieldExtension>,
    /** **Display text for the plan**

 A short description for the plan.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "planDisplay")]
    pub plan_display: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_planDisplay")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub plan_display_ext: Option<FieldExtension>,
    /** **An identifier for the subsection of the plan**

 Identifies a sub-style or sub-collective of coverage issued by the underwriter, for example may be used to identify a subset of a collection of benefits provided to employees.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subPlan")]
    pub sub_plan: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subPlan")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sub_plan_ext: Option<FieldExtension>,
    /** **Display text for the subsection of the plan**

 A short description for the subplan.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subPlanDisplay")]
    pub sub_plan_display: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subPlanDisplay")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sub_plan_display_ext: Option<FieldExtension>,
    /** **An identifier for the class**

 Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage such as a level of deductables or co-payment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "class")]
    pub class: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_class")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub class_ext: Option<FieldExtension>,
    /** **Display text for the class**

 A short description for the class.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "classDisplay")]
    pub class_display: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_classDisplay")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub class_display_ext: Option<FieldExtension>,
    /** **An identifier for the subsection of the class**

 Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a subclass of coverage such as a sub-level of deductables or co-payment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subClass")]
    pub sub_class: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subClass")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sub_class_ext: Option<FieldExtension>,
    /** **Display text for the subsection of the subclass**

 A short description for the subclass.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subClassDisplay")]
    pub sub_class_display: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subClassDisplay")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sub_class_display_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl CoverageGrouping {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> CoverageGroupingBuilder {
        CoverageGroupingBuilder::default()
    }
}
/** Base StructureDefinition for DataElement Resource

 **[DataElement](http://hl7.org/fhir/StructureDefinition/DataElement) v3.0.2**

 Resource data element

 The formal description of a single piece of information that can be gathered and reported.

 Often called a clinical template. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct DataElement(pub Box<DataElementInner>);
/** Base StructureDefinition for DataElement Resource

 **[DataElement](http://hl7.org/fhir/StructureDefinition/DataElement) v3.0.2**

 Resource data element

 The formal description of a single piece of information that can be gathered and reported.

 Often called a clinical template. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DataElementBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct DataElementInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "DataElement::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::DataElement", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical URI to reference this data element (globally unique)**

 An absolute URI that is used to identify this data element when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this data element is (or will be) published. The URL SHOULD include the major version of the data element. For more information see [Technical and Business Versions](resource.html#versions).

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred.  Multiple instances may share the same url if they have a distinct version. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "url")]
    pub url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Additional identifier for the data element**

 A formal identifier that is used to identify this data element when it is represented in other formats, or referenced in a specification, model, design or an instance.

 Typically, this is used for identifiers that can go in an HL7 V3 II (instance identifier) data type, e.g., to identify this data element outside of FHIR, where it is not possible to use the logical URI. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Business version of the data element**

 The identifier that is used to identify this version of the data element when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the data element author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.

 There may be different data element instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a refrence to a particular business version of the data element with the format [url]|[version]. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this data element. Enables tracking the life-cycle of the content.

 Allows filtering of data elements that are appropriate for use vs. not.
This is labeled as "Is Modifier" because applications should not use a retired data element without due consideration. */
    #[serde(rename = "status")]
    pub status: codes::PublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **For testing purposes, not real usage**

 A boolean value to indicate that this data element is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of data element that are appropriate for use vs. not. This is labeled as "Is Modifier" because applications should not use an experimental data element in production. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "experimental")]
    pub experimental: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_experimental")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub experimental_ext: Option<FieldExtension>,
    /** **Date this was last changed**

 The date  (and optionally time) when the data element was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the data element changes.

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the data element. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Name of the publisher (organization or individual)**

 The name of the individual or organization that published the data element.

 Usually an organization, but may be an individual. The publisher (or steward) of the data element is the organization or individual primarily responsible for the maintenance and upkeep of the data element. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the data element. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisher")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_ext: Option<FieldExtension>,
    /** **Name for this data element (computer friendly)**

 A natural language name identifying the data element. This name should be usable as an identifier for the module by machine processing applications such as code generation.

 The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure that it is computable friendly. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Name for this data element (human friendly)**

 A short, descriptive, user-friendly title for the data element.

 This name does not need to be machine-processing friendly and may contain punctuation, white-space, etc. This may be similar to the question used to prompt someone for a data element value, but the purpose is communicating about the data element, not asking the question.  (Refer to the 'question' element for the latter.). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **Contact details for the publisher**

 Contact details to assist a user in finding and communicating with the publisher.

 May be a web site, an email address, a telephone number, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Context the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate data element instances.

 When multiple useContexts are specified, there is no expectation whether all or any of the contexts apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useContext")]
    pub use_context: Vec<Option<UsageContext>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_useContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_context_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Intended jurisdiction for data element (if applicable)**

 A legal or geographic region in which the data element is intended to be used.

 It may be possible for the data element to be used in jurisdictions other than those for which it was originally designed or intended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **Use and/or publishing restrictions**

 A copyright statement relating to the data element and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the data element.

 null The copyright statement does not apply to values for the data element, only to its definition. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyright")]
    pub copyright: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyright")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_ext: Option<FieldExtension>,
    /** **[DataElementStringency](http://hl7.org/fhir/ValueSet/dataelement-stringency); comparable | fully-specified | equivalent | convertable | scaleable | flexible**

 Identifies how precise the data element is in its definition.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "stringency")]
    pub stringency: Option<codes::DataElementStringency>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_stringency")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub stringency_ext: Option<FieldExtension>,
    /** **External specification mapped to**

 Identifies a specification (other than a terminology) that the elements which make up the DataElement have some correspondence with.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "mapping")]
    pub mapping: Vec<Option<DataElementMapping>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_mapping")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub mapping_ext: Vec<Option<FieldExtension>>,
    /** **Definition of element**

 Defines the structure, type, allowed values and other constraining characteristics of the data element.

 For simple data types there will only be one repetition.  For complex data types, multiple repetitions will be present defining a nested structure using the "path" element. */
    #[serde(rename = "element")]
    pub element: Vec<Option<ElementDefinition>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_element")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub element_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl DataElementBuilder {
    #[doc = concat!("Finalize building ", "DataElement", ".")]
    pub fn build(self) -> Result<DataElement, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<DataElementInner> for DataElement {
    fn from(inner: DataElementInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for DataElement {
    type Target = DataElementInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for DataElement {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl DataElement {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> DataElementBuilder {
        DataElementBuilder::default()
    }
}
impl DataElement {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::DataElement
    }
}
/// Sub-fields of the mapping field in DataElement
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DataElementMappingBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DataElementMapping {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Internal id when this mapping is used**

 An internal id that is used to identify this mapping set when specific mappings are made on a per-element basis.

 The specification is described once, with general comments, and then specific mappings are made that reference this declaration. */
    #[serde(rename = "identity")]
    pub identity: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identity_ext: Option<FieldExtension>,
    /** **Identifies what this mapping refers to**

 An absolute URI that identifies the specification that this mapping is expressed to.

 A formal identity for the specification being mapped to helps with identifying maps consistently. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "uri")]
    pub uri: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_uri")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub uri_ext: Option<FieldExtension>,
    /** **Names what this mapping refers to**

 A name for the specification that is being mapped to.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Versions, issues, scope limitations, etc.**

 Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "comment")]
    pub comment: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_comment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub comment_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl DataElementMapping {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DataElementMappingBuilder {
        DataElementMappingBuilder::default()
    }
}
/** Base StructureDefinition for DetectedIssue Resource

 **[DetectedIssue](http://hl7.org/fhir/StructureDefinition/DetectedIssue) v3.0.2**

 Clinical issue with action

 Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, Ineffective treatment frequency, Procedure-condition conflict, etc.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct DetectedIssue(pub Box<DetectedIssueInner>);
/** Base StructureDefinition for DetectedIssue Resource

 **[DetectedIssue](http://hl7.org/fhir/StructureDefinition/DetectedIssue) v3.0.2**

 Clinical issue with action

 Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, Ineffective treatment frequency, Procedure-condition conflict, etc.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DetectedIssueBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct DetectedIssueInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "DetectedIssue::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::DetectedIssue", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Unique id for the detected issue**

 Business identifier associated with the detected issue record.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **[DetectedIssueStatus](http://hl7.org/fhir/ValueSet/observation-status); registered | preliminary | final | amended +**

 Indicates the status of the detected issue.

 This element is labeled as a modifier because the status contains the codes cancelled and entered-in-error that mark the issue as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::ObservationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[DetectedIssueCategory](http://hl7.org/fhir/ValueSet/detectedissue-category); Issue Category, e.g. drug-drug, duplicate therapy, etc.**

 Identifies the general type of issue identified.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[DetectedIssueSeverity](http://hl7.org/fhir/ValueSet/detectedissue-severity); high | moderate | low**

 Indicates the degree of importance associated with the identified issue based on the potential impact on the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "severity")]
    pub severity: Option<codes::DetectedIssueSeverity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_severity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub severity_ext: Option<FieldExtension>,
    /** **Associated patient**

 Indicates the patient whose record the detected issue is associated with.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patient")]
    pub patient: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_ext: Option<FieldExtension>,
    /** **When identified**

 The date or date-time when the detected issue was initially identified.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **The provider or device that identified the issue**

 Individual or device responsible for the issue being raised.  For example, a decision support application or a pharmacist conducting a medication review.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_author")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub author_ext: Option<FieldExtension>,
    /** **Problem resource**

 Indicates the resource representing the current activity or proposed activity that is potentially problematic.

 There's an implicit constraint on the number of implicated resources based on DetectedIssue.type; e.g. For drug-drug, there would be more than one.  For timing, there would typically only be one. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicated")]
    pub implicated: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_implicated")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub implicated_ext: Vec<Option<FieldExtension>>,
    /** **Description and context**

 A textual explanation of the detected issue.

 Should focus on information not covered elsewhere as discrete data - no need to duplicate the narrative. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "detail")]
    pub detail: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_detail")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub detail_ext: Option<FieldExtension>,
    /** **Authority for issue**

 The literature, knowledge-base or similar reference that describes the propensity for the detected issue identified.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reference")]
    pub reference: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reference_ext: Option<FieldExtension>,
    /** **Step taken to address**

 Indicates an action that has been taken or is committed to to reduce or eliminate the likelihood of the risk identified by the detected issue from manifesting.  Can also reflect an observation of known mitigating factors that may reduce/eliminate the need for any action.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "mitigation")]
    pub mitigation: Vec<Option<DetectedIssueMitigation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_mitigation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub mitigation_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl DetectedIssueBuilder {
    #[doc = concat!("Finalize building ", "DetectedIssue", ".")]
    pub fn build(self) -> Result<DetectedIssue, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<DetectedIssueInner> for DetectedIssue {
    fn from(inner: DetectedIssueInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for DetectedIssue {
    type Target = DetectedIssueInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for DetectedIssue {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl DetectedIssue {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> DetectedIssueBuilder {
        DetectedIssueBuilder::default()
    }
}
impl DetectedIssue {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::DetectedIssue
    }
}
/// Sub-fields of the mitigation field in DetectedIssue
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DetectedIssueMitigationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DetectedIssueMitigation {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DetectedIssueMitigationAction](http://hl7.org/fhir/ValueSet/detectedissue-mitigation-action); What mitigation?**

 Describes the action that was taken or the observation that was made that reduces/eliminates the risk associated with the identified issue.

 The "text" component can be used for detail or when no appropriate code exists. */
    #[serde(rename = "action")]
    pub action: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_action")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub action_ext: Option<FieldExtension>,
    /** **Date committed**

 Indicates when the mitigating action was documented.

 This may not be the same as when the mitigating step was actually taken. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Who is committing?**

 Identifies the practitioner who determined the mitigation and takes responsibility for the mitigation step occurring.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_author")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub author_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl DetectedIssueMitigation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DetectedIssueMitigationBuilder {
        DetectedIssueMitigationBuilder::default()
    }
}
/** Base StructureDefinition for Device Resource

 **[Device](http://hl7.org/fhir/StructureDefinition/Device) v3.0.2**

 Item used in healthcare

 This resource identifies an instance or a type of a manufactured item that is used in the provision of healthcare without being substantially changed through that activity. The device may be a medical or non-medical device.  Medical devices include durable (reusable) medical equipment, implantable devices, as well as disposable equipment used for diagnostic, treatment, and research for healthcare and public health.  Non-medical devices may include items such as a machine, cellphone, computer, application, etc.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Device(pub Box<DeviceInner>);
/** Base StructureDefinition for Device Resource

 **[Device](http://hl7.org/fhir/StructureDefinition/Device) v3.0.2**

 Item used in healthcare

 This resource identifies an instance or a type of a manufactured item that is used in the provision of healthcare without being substantially changed through that activity. The device may be a medical or non-medical device.  Medical devices include durable (reusable) medical equipment, implantable devices, as well as disposable equipment used for diagnostic, treatment, and research for healthcare and public health.  Non-medical devices may include items such as a machine, cellphone, computer, application, etc.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct DeviceInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Device::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Device", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Instance identifier**

 Unique instance identifiers assigned to a device by manufacturers other organizations or owners.

 The barcode string from a barcode present on a device label or package may identify the instance, include names given to the device in local usage, or may identify the type of device. If the identifier identifies the type of device, Device.type element should be used.  For [UDI](device.html#5.11.3.2.2),  this element corresponds to the variable portion of the UDI that identifies the serial number of a specific device. See [UDI mappings](device-mappings.html#udi) for a complete mapping of UDI parts to Device. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Unique Device Identifier (UDI) Barcode string**

 [Unique device identifier (UDI)](device.html#5.11.3.2.2) assigned to device label or package.

 UDI may identify an unique instance of a device, or it may only identify the type of the device.  See [UDI mappings](device-mappings.html#udi) for a complete mapping of UDI parts to Device. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "udi")]
    pub udi: Option<DeviceUdi>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_udi")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub udi_ext: Option<FieldExtension>,
    /** **[FHIRDeviceStatus](http://hl7.org/fhir/ValueSet/device-status); active | inactive | entered-in-error | unknown**

 Status of the Device availability.

 This element is labeled as a modifier because the status contains the codes inactive and entered-in-error that mark the device (record)as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<codes::FHIRDeviceStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[DeviceKind](http://hl7.org/fhir/ValueSet/device-kind); What kind of device this is**

 Code or identifier to identify a kind of device.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Lot number of manufacture**

 Lot number assigned by the manufacturer.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "lotNumber")]
    pub lot_number: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_lotNumber")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub lot_number_ext: Option<FieldExtension>,
    /** **Name of device manufacturer**

 A name of the manufacturer.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "manufacturer")]
    pub manufacturer: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_manufacturer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub manufacturer_ext: Option<FieldExtension>,
    /** **Date when the device was made**

 The date and time when the device was manufactured.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "manufactureDate")]
    pub manufacture_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_manufactureDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub manufacture_date_ext: Option<FieldExtension>,
    /** **Date and time of expiry of this device (if applicable)**

 The date and time beyond which this device is no longer valid or should not be used (if applicable).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "expirationDate")]
    pub expiration_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_expirationDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub expiration_date_ext: Option<FieldExtension>,
    /** **Model id assigned by the manufacturer**

 The "model" is an identifier assigned by the manufacturer to identify the product by its type. This number is shared by the all devices sold as the same type.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "model")]
    pub model: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_model")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub model_ext: Option<FieldExtension>,
    /** **Version number (i.e. software)**

 The version of the device, if the device has multiple releases under the same model, or if the device is software or carries firmware.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Patient to whom Device is affixed**

 Patient information, If the device is affixed to a person.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patient")]
    pub patient: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_ext: Option<FieldExtension>,
    /** **Organization responsible for device**

 An organization that is responsible for the provision and ongoing maintenance of the device.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "owner")]
    pub owner: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_owner")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub owner_ext: Option<FieldExtension>,
    /** **Details for human/organization for support**

 Contact details for an organization or a particular human that is responsible for the device.

 used for troubleshooting etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactPoint>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Where the resource is found**

 The place where the device can be found.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "location")]
    pub location: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_location")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub location_ext: Option<FieldExtension>,
    /** **Network address to contact device**

 A network address on which the device may be contacted directly.

 If the device is running a FHIR server, the network address should  be the Base URL from which a conformance statement may be retrieved. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "url")]
    pub url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Device notes and comments**

 Descriptive information, usage information or implantation information that is not captured in an existing element.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
    /** **[DeviceSafety](http://hl7.org/fhir/ValueSet/device-safety); Safety Characteristics of Device**

 Provides additional safety characteristics about a medical device.  For example devices containing latex.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "safety")]
    pub safety: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_safety")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub safety_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl DeviceBuilder {
    #[doc = concat!("Finalize building ", "Device", ".")]
    pub fn build(self) -> Result<Device, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<DeviceInner> for Device {
    fn from(inner: DeviceInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Device {
    type Target = DeviceInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Device {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Device {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> DeviceBuilder {
        DeviceBuilder::default()
    }
}
impl Device {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Device
    }
}
/// Sub-fields of the udi field in Device
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceUdiBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceUdi {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Mandatory fixed portion of UDI**

 The device identifier (DI) is a mandatory, fixed portion of a UDI that identifies the labeler and the specific version or model of a device.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "deviceIdentifier")]
    pub device_identifier: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_deviceIdentifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub device_identifier_ext: Option<FieldExtension>,
    /** **Device Name as appears on UDI label**

 Name of device as used in labeling or catalog.

 Use the `Device.type`  for a generic type or kind of device name.  Note the [GUDID](http://www.fda.gov/medicaldevices/deviceregulationandguidance/uniquedeviceidentification/globaludidatabasegudid/default.htm) lists the name as the 'Brand Name'. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Regional UDI authority**

 The identity of the authoritative source for UDI generation within a  jurisdiction.  All UDIs are globally unique within a single namespace. with the appropriate repository uri as the system.  For example,  UDIs of devices managed in the U.S. by the FDA, the value is  http://hl7.org/fhir/NamingSystem/fda-udi.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub jurisdiction_ext: Option<FieldExtension>,
    /** **UDI Human Readable Barcode String**

 The full UDI carrier as the human readable form (HRF) representation of the barcode string as printed on the packaging of the device.

 If separate barcodes for DI and PI are present, concatenate the string with DI first and in order of human readable expression on label. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "carrierHRF")]
    pub carrier_hrf: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_carrierHRF")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub carrier_hrf_ext: Option<FieldExtension>,
    /** **UDI Machine Readable Barcode String**

 The full UDI carrier of the Automatic Identification and Data Capture (AIDC) technology representation of the barcode string as printed on the packaging of the device - E.g a barcode or RFID.   Because of limitations on character sets in XML and the need to round-trip JSON data through XML, AIDC Formats *SHALL* be base64 encoded.

 The AIDC form of UDIs should be scanned or otherwise used for the identification of the device whenever possible to minimize errors in records resulting from manual transcriptions. If separate barcodes for DI and PI are present, concatenate the string with DI first and in order of human readable expression on label. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "carrierAIDC")]
    pub carrier_aidc: Option<Base64Binary>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_carrierAIDC")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub carrier_aidc_ext: Option<FieldExtension>,
    /** **UDI Issuing Organization**

 Organization that is charged with issuing UDIs for devices.  For example, the US FDA issuers include :
1) GS1:
http://hl7.org/fhir/NamingSystem/gs1-di,
2) HIBCC:
http://hl7.org/fhir/NamingSystem/hibcc-dI,
3) ICCBBA for blood containers:
http://hl7.org/fhir/NamingSystem/iccbba-blood-di,
4) ICCBA for other devices:
http://hl7.org/fhir/NamingSystem/iccbba-other-di.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "issuer")]
    pub issuer: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_issuer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub issuer_ext: Option<FieldExtension>,
    /** **[UDIEntryType](http://hl7.org/fhir/ValueSet/udi-entry-type); barcode | rfid | manual +**

 A coded entry to indicate how the data was entered.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "entryType")]
    pub entry_type: Option<codes::UDIEntryType>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_entryType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub entry_type_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl DeviceUdi {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceUdiBuilder {
        DeviceUdiBuilder::default()
    }
}
/** Base StructureDefinition for DeviceComponent Resource

 **[DeviceComponent](http://hl7.org/fhir/StructureDefinition/DeviceComponent) v3.0.2**

 An instance of a medical-related component of a medical device

 The characteristics, operational status and capabilities of a medical-related component of a medical device.

 For the initial scope, this DeviceComponent resource is only applicable to describe a single node in the containment tree that is produced by the context scanner in any medical device that implements or derives from the ISO/IEEE 11073 standard and that does not represent a metric. Examples for such a node are MDS, VMD, or Channel. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct DeviceComponent(pub Box<DeviceComponentInner>);
/** Base StructureDefinition for DeviceComponent Resource

 **[DeviceComponent](http://hl7.org/fhir/StructureDefinition/DeviceComponent) v3.0.2**

 An instance of a medical-related component of a medical device

 The characteristics, operational status and capabilities of a medical-related component of a medical device.

 For the initial scope, this DeviceComponent resource is only applicable to describe a single node in the containment tree that is produced by the context scanner in any medical device that implements or derives from the ISO/IEEE 11073 standard and that does not represent a metric. Examples for such a node are MDS, VMD, or Channel. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceComponentBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct DeviceComponentInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "DeviceComponent::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::DeviceComponent", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Instance id assigned by the software stack**

 The locally assigned unique identification by the software. For example: handle ID.

 */
    #[serde(rename = "identifier")]
    pub identifier: Identifier,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **[ComponentType](http://hl7.org/fhir/ValueSet/device-kind); What kind of component it is**

 The component type as defined in the object-oriented or metric nomenclature partition.

 DeviceComponent.type can be referred to either GDMN (nomenclature system supported by FDA Global UDI Database) or preferable RTMMS coding system. */
    #[serde(rename = "type")]
    pub r#type: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Recent system change timestamp**

 The timestamp for the most recent system change which includes device configuration or setting change.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "lastSystemChange")]
    pub last_system_change: Option<Instant>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_lastSystemChange")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub last_system_change_ext: Option<FieldExtension>,
    /** **Top-level device resource link**

 The link to the source Device that contains administrative device information such as manufacture, serial number, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "source")]
    pub source: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_source")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_ext: Option<FieldExtension>,
    /** **Parent resource link**

 The link to the parent resource. For example: Channel is linked to its VMD parent.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parent")]
    pub parent: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_parent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub parent_ext: Option<FieldExtension>,
    /** **[DeviceComponentOperationalStatus](http://hl7.org/fhir/ValueSet/operational-status); Current operational status of the component, for example On, Off or Standby**

 The current operational status of the device. For example: On, Off, Standby, etc.

 OperationalStatus for the MDS, VMD, or Channel will be bound to a specific ValueSet that is defined in its profile. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "operationalStatus")]
    pub operational_status: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_operationalStatus")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub operational_status_ext: Vec<Option<FieldExtension>>,
    /** **[DeviceComponentParameterGroup](http://hl7.org/fhir/ValueSet/parameter-group); Current supported parameter group**

 The parameter group supported by the current device component that is based on some nomenclature, e.g. cardiovascular.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parameterGroup")]
    pub parameter_group: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_parameterGroup")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub parameter_group_ext: Option<FieldExtension>,
    /** **[MeasmntPrinciple](http://hl7.org/fhir/ValueSet/measurement-principle); other | chemical | electrical | impedance | nuclear | optical | thermal | biological | mechanical | acoustical | manual+**

 The physical principle of the measurement. For example: thermal, chemical, acoustical, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "measurementPrinciple")]
    pub measurement_principle: Option<codes::MeasmntPrinciple>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_measurementPrinciple")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub measurement_principle_ext: Option<FieldExtension>,
    /** **Specification details such as Component Revisions, or Serial Numbers**

 The production specification such as component revision, serial number, etc.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productionSpecification")]
    pub production_specification: Vec<Option<DeviceComponentProductionSpecification>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_productionSpecification")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub production_specification_ext: Vec<Option<FieldExtension>>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language code for the human-readable text strings produced by the device**

 The language code for the human-readable text string produced by the device. This language code will follow the IETF language tag. Example: en-US.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "languageCode")]
    pub language_code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_languageCode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub language_code_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl DeviceComponentBuilder {
    #[doc = concat!("Finalize building ", "DeviceComponent", ".")]
    pub fn build(self) -> Result<DeviceComponent, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<DeviceComponentInner> for DeviceComponent {
    fn from(inner: DeviceComponentInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for DeviceComponent {
    type Target = DeviceComponentInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for DeviceComponent {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl DeviceComponent {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> DeviceComponentBuilder {
        DeviceComponentBuilder::default()
    }
}
impl DeviceComponent {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::DeviceComponent
    }
}
/// Sub-fields of the productionSpecification field in DeviceComponent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceComponentProductionSpecificationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceComponentProductionSpecification {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DeviceSpecificationSpecType](http://hl7.org/fhir/ValueSet/specification-type); Type or kind of production specification, for example serial number or software revision**

 The specification type, such as, serial number, part number, hardware revision, software revision, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "specType")]
    pub spec_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_specType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub spec_type_ext: Option<FieldExtension>,
    /** **Internal component unique identification**

 The internal component unique identification. This is a provision for manufacture specific standard components using a private OID. 11073-10101 has a partition for private OID semantic that the manufacturer can make use of.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "componentId")]
    pub component_id: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_componentId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub component_id_ext: Option<FieldExtension>,
    /** **A printable string defining the component**

 The printable string defining the component.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productionSpec")]
    pub production_spec: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productionSpec")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub production_spec_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl DeviceComponentProductionSpecification {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceComponentProductionSpecificationBuilder {
        DeviceComponentProductionSpecificationBuilder::default()
    }
}
/** Base StructureDefinition for DeviceMetric Resource

 **[DeviceMetric](http://hl7.org/fhir/StructureDefinition/DeviceMetric) v3.0.2**

 Measurement, calculation or setting capability of a medical device

 Describes a measurement, calculation or setting capability of a medical device.

 For the initial scope, this DeviceMetric resource is only applicable to describe a single metric node in the containment tree that is produced by the context scanner in any medical device that implements or derives from the ISO/IEEE 11073 standard. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct DeviceMetric(pub Box<DeviceMetricInner>);
/** Base StructureDefinition for DeviceMetric Resource

 **[DeviceMetric](http://hl7.org/fhir/StructureDefinition/DeviceMetric) v3.0.2**

 Measurement, calculation or setting capability of a medical device

 Describes a measurement, calculation or setting capability of a medical device.

 For the initial scope, this DeviceMetric resource is only applicable to describe a single metric node in the containment tree that is produced by the context scanner in any medical device that implements or derives from the ISO/IEEE 11073 standard. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceMetricBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct DeviceMetricInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "DeviceMetric::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::DeviceMetric", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Unique identifier of this DeviceMetric**

 Describes the unique identification of this metric that has been assigned by the device or gateway software. For example: handle ID.  It should be noted that in order to make the identifier unique, the system element of the identifier should be set to the unique identifier of the device.

 */
    #[serde(rename = "identifier")]
    pub identifier: Identifier,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **[MetricType](http://hl7.org/fhir/ValueSet/devicemetric-type); Identity of metric, for example Heart Rate or PEEP Setting**

 Describes the type of the metric. For example: Heart Rate, PEEP Setting, etc.

 DeviceMetric.type can be referred to either IEEE 11073-10101 or LOINC. */
    #[serde(rename = "type")]
    pub r#type: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[MetricUnit](http://hl7.org/fhir/ValueSet/devicemetric-type); Unit of Measure for the Metric**

 Describes the unit that an observed value determined for this metric will have. For example: Percent, Seconds, etc.

 DeviceMetric.unit can refer to either UCUM or preferable a RTMMS coding system. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "unit")]
    pub unit: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_unit")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub unit_ext: Option<FieldExtension>,
    /** **Describes the link to the source Device**

 Describes the link to the  Device that this DeviceMetric belongs to and that contains administrative device information such as manufacturer, serial number, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "source")]
    pub source: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_source")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_ext: Option<FieldExtension>,
    /** **Describes the link to the parent DeviceComponent**

 Describes the link to the  DeviceComponent that this DeviceMetric belongs to and that provide information about the location of this DeviceMetric in the containment structure of the parent Device. An example would be a DeviceComponent that represents a Channel. This reference can be used by a client application to distinguish DeviceMetrics that have the same type, but should be interpreted based on their containment location.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parent")]
    pub parent: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_parent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub parent_ext: Option<FieldExtension>,
    /** **[DeviceMetricOperationalStatus](http://hl7.org/fhir/ValueSet/metric-operational-status); on | off | standby | entered-in-error**

 Indicates current operational state of the device. For example: On, Off, Standby, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "operationalStatus")]
    pub operational_status: Option<codes::DeviceMetricOperationalStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_operationalStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub operational_status_ext: Option<FieldExtension>,
    /** **[DeviceMetricColor](http://hl7.org/fhir/ValueSet/metric-color); black | red | green | yellow | blue | magenta | cyan | white**

 Describes the color representation for the metric. This is often used to aid clinicians to track and identify parameter types by color. In practice, consider a Patient Monitor that has ECG/HR and Pleth for example; the parameters are displayed in different characteristic colors, such as HR-blue, BP-green, and PR and SpO2- magenta.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "color")]
    pub color: Option<codes::DeviceMetricColor>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_color")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub color_ext: Option<FieldExtension>,
    /** **[DeviceMetricCategory](http://hl7.org/fhir/ValueSet/metric-category); measurement | setting | calculation | unspecified**

 Indicates the category of the observation generation process. A DeviceMetric can be for example a setting, measurement, or calculation.

 */
    #[serde(rename = "category")]
    pub category: codes::DeviceMetricCategory,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **Describes the measurement repetition time**

 Describes the measurement repetition time. This is not necessarily the same as the update period. The measurement repetition time can range from milliseconds up to hours. An example for a measurement repetition time in the range of milliseconds is the sampling rate of an ECG. An example for a measurement repetition time in the range of hours is a NIBP that is triggered automatically every hour. The update period may be different than the measurement repetition time, if the device does not update the published observed value with the same frequency as it was measured.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "measurementPeriod")]
    pub measurement_period: Option<Timing>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_measurementPeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub measurement_period_ext: Option<FieldExtension>,
    /** **Describes the calibrations that have been performed or that are required to be performed**

 Describes the calibrations that have been performed or that are required to be performed.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "calibration")]
    pub calibration: Vec<Option<DeviceMetricCalibration>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_calibration")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub calibration_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl DeviceMetricBuilder {
    #[doc = concat!("Finalize building ", "DeviceMetric", ".")]
    pub fn build(self) -> Result<DeviceMetric, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<DeviceMetricInner> for DeviceMetric {
    fn from(inner: DeviceMetricInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for DeviceMetric {
    type Target = DeviceMetricInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for DeviceMetric {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl DeviceMetric {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> DeviceMetricBuilder {
        DeviceMetricBuilder::default()
    }
}
impl DeviceMetric {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::DeviceMetric
    }
}
/// Sub-fields of the calibration field in DeviceMetric
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceMetricCalibrationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceMetricCalibration {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DeviceMetricCalibrationType](http://hl7.org/fhir/ValueSet/metric-calibration-type); unspecified | offset | gain | two-point**

 Describes the type of the calibration method.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<codes::DeviceMetricCalibrationType>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[DeviceMetricCalibrationState](http://hl7.org/fhir/ValueSet/metric-calibration-state); not-calibrated | calibration-required | calibrated | unspecified**

 Describes the state of the calibration.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "state")]
    pub state: Option<codes::DeviceMetricCalibrationState>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_state")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub state_ext: Option<FieldExtension>,
    /** **Describes the time last calibration has been performed**

 Describes the time last calibration has been performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "time")]
    pub time: Option<Instant>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_time")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub time_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl DeviceMetricCalibration {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceMetricCalibrationBuilder {
        DeviceMetricCalibrationBuilder::default()
    }
}
/** Base StructureDefinition for DeviceRequest Resource

 **[DeviceRequest](http://hl7.org/fhir/StructureDefinition/DeviceRequest) v3.0.2**

 Medical device request

 Represents a request for a patient to employ a medical device. The device may be an implantable device, or an external assistive device, such as a walker.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct DeviceRequest(pub Box<DeviceRequestInner>);
/** Base StructureDefinition for DeviceRequest Resource

 **[DeviceRequest](http://hl7.org/fhir/StructureDefinition/DeviceRequest) v3.0.2**

 Medical device request

 Represents a request for a patient to employ a medical device. The device may be an implantable device, or an external assistive device, such as a walker.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceRequestBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct DeviceRequestInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "DeviceRequest::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::DeviceRequest", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **External Request identifier**

 Identifiers assigned to this order by the orderer or by the receiver.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Protocol or definition**

 Protocol or definition followed by this request. For example: The proposed act must be performed if the indicated conditions occur, e.g.., shortness of breath, SpO2 less than x%.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definition")]
    pub definition: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_definition")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub definition_ext: Vec<Option<FieldExtension>>,
    /** **What request fulfills**

 Plan/proposal/order fulfilled by this request.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basedOn")]
    pub based_on: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_basedOn")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub based_on_ext: Vec<Option<FieldExtension>>,
    /** **What request replaces**

 The request takes the place of the referenced completed or terminated request(s).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "priorRequest")]
    pub prior_request: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_priorRequest")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub prior_request_ext: Vec<Option<FieldExtension>>,
    /** **Identifier of composite request**

 Composite request this is part of.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "groupIdentifier")]
    pub group_identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_groupIdentifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub group_identifier_ext: Option<FieldExtension>,
    /** **[DeviceRequestStatus](http://hl7.org/fhir/ValueSet/request-status); draft | active | suspended | completed | entered-in-error | cancelled**

 The status of the request.

 This element is labeled as a modifier because the status contains the codes cancelled and entered-in-error that mark the request as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<codes::RequestStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[RequestIntent](http://hl7.org/fhir/ValueSet/request-intent); proposal | plan | original-order | encoded | reflex-order**

 Whether the request is a proposal, plan, an original order or a reflex order.

 */
    #[serde(rename = "intent")]
    pub intent: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_intent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub intent_ext: Option<FieldExtension>,
    /** **[RequestPriority](http://hl7.org/fhir/ValueSet/request-priority); Indicates how quickly the {{title}} should be addressed with respect to other requests**

 Indicates how quickly the {{title}} should be addressed with respect to other requests.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "priority")]
    pub priority: Option<codes::RequestPriority>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_priority")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub priority_ext: Option<FieldExtension>,
    /** **Device requested**

 The details of the device to be used.

 */
    #[serde(flatten)]
    pub code: DeviceRequestCode,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<DeviceRequestCodeExtension>,
    /** **Focus of request**

 The patient who will use the device.

 */
    #[serde(rename = "subject")]
    pub subject: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Encounter or Episode motivating request**

 An encounter that provides additional context in which this request is made.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **Desired time or schedule for use**

 The timing schedule for the use of the device. The Schedule data type allows many different expressions, for example. "Every 8 hours"; "Three times a day"; "1/2 an hour before breakfast for 10 days from 23-Dec 2011:"; "15 Oct 2013, 17 Oct 2013 and 1 Nov 2013".

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub occurrence: Option<DeviceRequestOccurrence>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub occurrence_ext: Option<DeviceRequestOccurrenceExtension>,
    /** **When recorded**

 When the request transitioned to being actionable.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authoredOn")]
    pub authored_on: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_authoredOn")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub authored_on_ext: Option<FieldExtension>,
    /** **Who/what is requesting diagnostics**

 The individual who initiated the request and has responsibility for its activation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requester")]
    pub requester: Option<DeviceRequestRequester>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requester")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub requester_ext: Option<FieldExtension>,
    /** **[DeviceRequestParticipantRole](http://hl7.org/fhir/ValueSet/participant-role); Fille role**

 Desired type of performer for doing the diagnostic testing.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performerType")]
    pub performer_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_performerType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub performer_type_ext: Option<FieldExtension>,
    /** **Requested Filler**

 The desired perfomer for doing the diagnostic testing.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_performer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub performer_ext: Option<FieldExtension>,
    /** **[DeviceRequestReason](http://hl7.org/fhir/ValueSet/condition-code); Coded Reason for request**

 Reason or justification for the use of this device.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonCode")]
    pub reason_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_code_ext: Vec<Option<FieldExtension>>,
    /** **Linked Reason for request**

 Reason or justification for the use of this device.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonReference")]
    pub reason_reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_reference_ext: Vec<Option<FieldExtension>>,
    /** **Additional clinical information**

 Additional clinical information about the patient that may influence the request fulfilment.  For example, this may includes body where on the subject's the device will be used ( i.e. the target site).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "supportingInfo")]
    pub supporting_info: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_supportingInfo")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub supporting_info_ext: Vec<Option<FieldExtension>>,
    /** **Notes or comments**

 Details about this request that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
    /** **Request provenance**

 Key events in the history of the request.

 This may not include provenances for all versions of the request – only those deemed “relevant” or important.
This SHALL NOT include the Provenance associated with this current version of the resource.  (If that provenance is deemed to be a “relevant” change, it will need to be added as part of a later update.  Until then, it can be queried directly as the Provenance that points to this version using _revinclude
All Provenances should have some historical version of this Request as their subject. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relevantHistory")]
    pub relevant_history: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_relevantHistory")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub relevant_history_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl DeviceRequestBuilder {
    #[doc = concat!("Finalize building ", "DeviceRequest", ".")]
    pub fn build(self) -> Result<DeviceRequest, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<DeviceRequestInner> for DeviceRequest {
    fn from(inner: DeviceRequestInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for DeviceRequest {
    type Target = DeviceRequestInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for DeviceRequest {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl DeviceRequest {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> DeviceRequestBuilder {
        DeviceRequestBuilder::default()
    }
}
impl DeviceRequest {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::DeviceRequest
    }
}
/// Choice of types for the code[x] field in DeviceRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DeviceRequestCode {
    /// Variant accepting the Reference type.
    #[serde(rename = "codeReference")]
    Reference(Reference),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "codeCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for DeviceRequestCode.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DeviceRequestCodeExtension {
    /// Variant accepting the Reference extension.
    #[serde(rename = "_codeReference")]
    Reference(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_codeCodeableConcept")]
    CodeableConcept(FieldExtension),
}
/// Choice of types for the occurrence[x] field in DeviceRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DeviceRequestOccurrence {
    /// Variant accepting the DateTime type.
    #[serde(rename = "occurrenceDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "occurrencePeriod")]
    Period(Period),
    /// Variant accepting the Timing type.
    #[serde(rename = "occurrenceTiming")]
    Timing(Timing),
}
/// Extension value for DeviceRequestOccurrence.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DeviceRequestOccurrenceExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_occurrenceDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_occurrencePeriod")]
    Period(FieldExtension),
    /// Variant accepting the Timing extension.
    #[serde(rename = "_occurrenceTiming")]
    Timing(FieldExtension),
}
/// Sub-fields of the requester field in DeviceRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceRequestRequesterBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DeviceRequestRequester {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Individual making the request**

 The device, practitioner, etc. who initiated the request.

 */
    #[serde(rename = "agent")]
    pub agent: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_agent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub agent_ext: Option<FieldExtension>,
    /** **Organization agent is acting for**

 The organization the device or practitioner was acting on behalf of.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "onBehalfOf")]
    pub on_behalf_of: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_onBehalfOf")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub on_behalf_of_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl DeviceRequestRequester {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DeviceRequestRequesterBuilder {
        DeviceRequestRequesterBuilder::default()
    }
}
/** Base StructureDefinition for DeviceUseStatement Resource

 **[DeviceUseStatement](http://hl7.org/fhir/StructureDefinition/DeviceUseStatement) v3.0.2**

 Record of use of a device

 A record of a device being used by a patient where the record is the result of a report from the patient or another clinician.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct DeviceUseStatement(pub Box<DeviceUseStatementInner>);
/** Base StructureDefinition for DeviceUseStatement Resource

 **[DeviceUseStatement](http://hl7.org/fhir/StructureDefinition/DeviceUseStatement) v3.0.2**

 Record of use of a device

 A record of a device being used by a patient where the record is the result of a report from the patient or another clinician.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DeviceUseStatementBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct DeviceUseStatementInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "DeviceUseStatement::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::DeviceUseStatement", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **External identifier for this record**

 An external identifier for this statement such as an IRI.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[DeviceUseStatementStatus](http://hl7.org/fhir/ValueSet/device-statement-status); active | completed | entered-in-error +**

 A code representing the patient or other source's judgment about the state of the device used that this statement is about.  Generally this will be active or completed.

 DeviceUseStatment is a statement at a point in time.  The status is only representative at the point when it was asserted.  The value set for contains codes that assert the status of the use  by the patient (for example, stopped or on hold) as well as codes that assert the status of the resource itself (for example, entered in error).

This element is labeled as a modifier because the status contains the codes that mark the statement as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::DeviceUseStatementStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **Patient using device**

 The patient who used the device.

 */
    #[serde(rename = "subject")]
    pub subject: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Period device was used**

 The time period over which the device was used.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "whenUsed")]
    pub when_used: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_whenUsed")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub when_used_ext: Option<FieldExtension>,
    /** **How often  the device was used**

 How often the device was used.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub timing: Option<DeviceUseStatementTiming>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub timing_ext: Option<DeviceUseStatementTimingExtension>,
    /** **When statement was recorded**

 The time at which the statement was made/recorded.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recordedOn")]
    pub recorded_on: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_recordedOn")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub recorded_on_ext: Option<FieldExtension>,
    /** **Who made the statement**

 Who reported the device was being used by the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "source")]
    pub source: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_source")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_ext: Option<FieldExtension>,
    /** **Reference to device used**

 The details of the device used.

 */
    #[serde(rename = "device")]
    pub device: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_device")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub device_ext: Option<FieldExtension>,
    /** **Why device was used**

 Reason or justification for the use of the device.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "indication")]
    pub indication: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_indication")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub indication_ext: Vec<Option<FieldExtension>>,
    /** **[BodySite](http://hl7.org/fhir/ValueSet/body-site); Target body site**

 Indicates the site on the subject's body where the device was used ( i.e. the target site).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "bodySite")]
    pub body_site: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_bodySite")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub body_site_ext: Option<FieldExtension>,
    /** **Addition details (comments, instructions)**

 Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl DeviceUseStatementBuilder {
    #[doc = concat!("Finalize building ", "DeviceUseStatement", ".")]
    pub fn build(self) -> Result<DeviceUseStatement, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<DeviceUseStatementInner> for DeviceUseStatement {
    fn from(inner: DeviceUseStatementInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for DeviceUseStatement {
    type Target = DeviceUseStatementInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for DeviceUseStatement {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl DeviceUseStatement {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> DeviceUseStatementBuilder {
        DeviceUseStatementBuilder::default()
    }
}
impl DeviceUseStatement {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::DeviceUseStatement
    }
}
/// Choice of types for the timing[x] field in DeviceUseStatement
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DeviceUseStatementTiming {
    /// Variant accepting the Timing type.
    #[serde(rename = "timingTiming")]
    Timing(Timing),
    /// Variant accepting the Period type.
    #[serde(rename = "timingPeriod")]
    Period(Period),
    /// Variant accepting the DateTime type.
    #[serde(rename = "timingDateTime")]
    DateTime(DateTime),
}
/// Extension value for DeviceUseStatementTiming.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DeviceUseStatementTimingExtension {
    /// Variant accepting the Timing extension.
    #[serde(rename = "_timingTiming")]
    Timing(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_timingPeriod")]
    Period(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_timingDateTime")]
    DateTime(FieldExtension),
}
/** Base StructureDefinition for DiagnosticReport Resource

 **[DiagnosticReport](http://hl7.org/fhir/StructureDefinition/DiagnosticReport) v3.0.2**

 A Diagnostic report - a combination of request information, atomic results, images, interpretation, as well as formatted reports

 The findings and interpretation of diagnostic  tests performed on patients, groups of patients, devices, and locations, and/or specimens derived from these. The report includes clinical context such as requesting and provider information, and some mix of atomic results, images, textual and coded interpretations, and formatted representation of diagnostic reports.

 This is intended to capture a single report, and is not suitable for use in displaying summary information that covers multiple reports.  For example, this resource has not been designed for laboratory cumulative reporting formats nor detailed structured reports for sequencing. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct DiagnosticReport(pub Box<DiagnosticReportInner>);
/** Base StructureDefinition for DiagnosticReport Resource

 **[DiagnosticReport](http://hl7.org/fhir/StructureDefinition/DiagnosticReport) v3.0.2**

 A Diagnostic report - a combination of request information, atomic results, images, interpretation, as well as formatted reports

 The findings and interpretation of diagnostic  tests performed on patients, groups of patients, devices, and locations, and/or specimens derived from these. The report includes clinical context such as requesting and provider information, and some mix of atomic results, images, textual and coded interpretations, and formatted representation of diagnostic reports.

 This is intended to capture a single report, and is not suitable for use in displaying summary information that covers multiple reports.  For example, this resource has not been designed for laboratory cumulative reporting formats nor detailed structured reports for sequencing. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DiagnosticReportBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct DiagnosticReportInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "DiagnosticReport::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::DiagnosticReport", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business identifier for report**

 Identifiers assigned to this report by the performer or other systems.

 Usually assigned by the Information System of the diagnostic service provider (filler id). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **What was requested**

 Details concerning a test or procedure requested.

 Note: Usually there is one test request for each result, however in some circumstances multiple test requests may be represented using a single test result resource. Note that there are also cases where one request leads to multiple reports. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basedOn")]
    pub based_on: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_basedOn")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub based_on_ext: Vec<Option<FieldExtension>>,
    /** **[DiagnosticReportStatus](http://hl7.org/fhir/ValueSet/diagnostic-report-status); registered | partial | preliminary | final +**

 The status of the diagnostic report as a whole.

 This is labeled as "Is Modifier" because applications need to take appropriate action if a report is withdrawn. */
    #[serde(rename = "status")]
    pub status: codes::DiagnosticReportStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[DiagnosticServiceSection](http://hl7.org/fhir/ValueSet/diagnostic-service-sections); Service category**

 A code that classifies the clinical discipline, department or diagnostic service that created the report (e.g. cardiology, biochemistry, hematology, MRI). This is used for searching, sorting and display purposes.

 The level of granularity is defined by the category concepts in the value set. More fine-grained filtering can be performed using the metadata and/or terminology hierarchy in DiagnosticReport.code. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[DiagnosticReportCodes](http://hl7.org/fhir/ValueSet/report-codes); Name/Code for this diagnostic report**

 A code or name that describes this diagnostic report.

 */
    #[serde(rename = "code")]
    pub code: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **The subject of the report - usually, but not always, the patient**

 The subject of the report. Usually, but not always, this is a patient. However diagnostic services also perform analyses on specimens collected from a variety of other sources.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Health care event when test ordered**

 The healthcare event  (e.g. a patient and healthcare provider interaction) which this DiagnosticReport per is about.

 This will typically be the encounter the event occurred within, but some events may be initiated prior to or after the official completion of an encounter or episode but still be tied to the context of the encounter or episode (e.g. pre-admission lab tests). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **Clinically relevant time/time-period for report**

 The time or time-period the observed values are related to. When the subject of the report is a patient, this is usually either the time of the procedure or of specimen collection(s), but very often the source of the date/time is not known, only the date/time itself.

 If the diagnostic procedure was performed on the patient, this is the time it was performed. If there are specimens, the diagnostically relevant time can be derived from the specimen collection times, but the specimen information is not always available, and the exact relationship between the specimens and the diagnostically relevant time is not always automatic. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub effective: Option<DiagnosticReportEffective>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub effective_ext: Option<DiagnosticReportEffectiveExtension>,
    /** **DateTime this version was released**

 The date and time that this version of the report was released from the source diagnostic service.

 May be different from the update time of the resource itself, because that is the status of the record (potentially a secondary copy), not the actual release time of the report. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "issued")]
    pub issued: Option<Instant>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_issued")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub issued_ext: Option<FieldExtension>,
    /** **Participants in producing the report**

 Indicates who or what participated in producing the report.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Vec<Option<DiagnosticReportPerformer>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_performer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub performer_ext: Vec<Option<FieldExtension>>,
    /** **Specimens this report is based on**

 Details about the specimens on which this diagnostic report is based.

 If the specimen is sufficiently specified with a code in the test result name, then this additional data may be redundant. If there are multiple specimens, these may be represented per observation or group. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "specimen")]
    pub specimen: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_specimen")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub specimen_ext: Vec<Option<FieldExtension>>,
    /** **Observations - simple, or complex nested groups**

 Observations that are part of this diagnostic report. Observations can be simple name/value pairs (e.g. "atomic" results), or they can be grouping observations that include references to other members of the group (e.g. "panels").

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "result")]
    pub result: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_result")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub result_ext: Vec<Option<FieldExtension>>,
    /** **Reference to full details of imaging associated with the diagnostic report**

 One or more links to full details of any imaging performed during the diagnostic investigation. Typically, this is imaging performed by DICOM enabled modalities, but this is not required. A fully enabled PACS viewer can use this information to provide views of the source images.

 ImagingStudy and ImageManifest and the image element are somewhat overlapping - typically, the list of image references in the image element will also be found in one of the imaging study resources. However each caters to different types of displays for different types of purposes. Neither, either, or both may be provided. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "imagingStudy")]
    pub imaging_study: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_imagingStudy")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub imaging_study_ext: Vec<Option<FieldExtension>>,
    /** **Key images associated with this report**

 A list of key images associated with this report. The images are generally created during the diagnostic process, and may be directly of the patient, or of treated specimens (i.e. slides of interest).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "image")]
    pub image: Vec<Option<DiagnosticReportImage>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_image")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub image_ext: Vec<Option<FieldExtension>>,
    /** **Clinical Interpretation of test results**

 Concise and clinically contextualized impression / summary of the diagnostic report.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "conclusion")]
    pub conclusion: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_conclusion")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub conclusion_ext: Option<FieldExtension>,
    /** **[AdjunctDiagnosis](http://hl7.org/fhir/ValueSet/clinical-findings); Codes for the conclusion**

 Codes for the conclusion.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "codedDiagnosis")]
    pub coded_diagnosis: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_codedDiagnosis")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub coded_diagnosis_ext: Vec<Option<FieldExtension>>,
    /** **Entire report as issued**

 Rich text representation of the entire result as issued by the diagnostic service. Multiple formats are allowed but they SHALL be semantically equivalent.

 "application/pdf" is recommended as the most reliable and interoperable in this context. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "presentedForm")]
    pub presented_form: Vec<Option<Attachment>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_presentedForm")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub presented_form_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl DiagnosticReportBuilder {
    #[doc = concat!("Finalize building ", "DiagnosticReport", ".")]
    pub fn build(self) -> Result<DiagnosticReport, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<DiagnosticReportInner> for DiagnosticReport {
    fn from(inner: DiagnosticReportInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for DiagnosticReport {
    type Target = DiagnosticReportInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for DiagnosticReport {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl DiagnosticReport {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> DiagnosticReportBuilder {
        DiagnosticReportBuilder::default()
    }
}
impl DiagnosticReport {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::DiagnosticReport
    }
}
/// Choice of types for the effective[x] field in DiagnosticReport
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DiagnosticReportEffective {
    /// Variant accepting the DateTime type.
    #[serde(rename = "effectiveDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "effectivePeriod")]
    Period(Period),
}
/// Extension value for DiagnosticReportEffective.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DiagnosticReportEffectiveExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_effectiveDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_effectivePeriod")]
    Period(FieldExtension),
}
/// Sub-fields of the performer field in DiagnosticReport
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DiagnosticReportPerformerBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DiagnosticReportPerformer {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[Role](http://hl7.org/fhir/ValueSet/performer-role); Type of performer**

 Describes the type of participation (e.g.  a responsible party, author, or verifier).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "role")]
    pub role: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_role")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub role_ext: Option<FieldExtension>,
    /** **Practitioner or Organization  participant**

 The reference to the  practitioner or organization involved in producing the report. For example, the diagnostic service that is responsible for issuing the report.

 This is not necessarily the source of the atomic data items. It is the entity that takes responsibility for the clinical report. */
    #[serde(rename = "actor")]
    pub actor: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_actor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub actor_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl DiagnosticReportPerformer {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DiagnosticReportPerformerBuilder {
        DiagnosticReportPerformerBuilder::default()
    }
}
/// Sub-fields of the image field in DiagnosticReport
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DiagnosticReportImageBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DiagnosticReportImage {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Comment about the image (e.g. explanation)**

 A comment about the image. Typically, this is used to provide an explanation for why the image is included, or to draw the viewer's attention to important features.

 The comment should be displayed with the image. It would be common for the report to include additional discussion of the image contents in other sections such as the conclusion. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "comment")]
    pub comment: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_comment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub comment_ext: Option<FieldExtension>,
    /** **Reference to the image source**

 Reference to the image source.

 */
    #[serde(rename = "link")]
    pub link: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_link")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub link_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl DiagnosticReportImage {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DiagnosticReportImageBuilder {
        DiagnosticReportImageBuilder::default()
    }
}
/** Base StructureDefinition for DocumentManifest Resource

 **[DocumentManifest](http://hl7.org/fhir/StructureDefinition/DocumentManifest) v3.0.2**

 A list that defines a set of documents

 A collection of documents compiled for a purpose together with metadata that applies to the collection.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct DocumentManifest(pub Box<DocumentManifestInner>);
/** Base StructureDefinition for DocumentManifest Resource

 **[DocumentManifest](http://hl7.org/fhir/StructureDefinition/DocumentManifest) v3.0.2**

 A list that defines a set of documents

 A collection of documents compiled for a purpose together with metadata that applies to the collection.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DocumentManifestBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct DocumentManifestInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "DocumentManifest::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::DocumentManifest", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Unique Identifier for the set of documents**

 A single identifier that uniquely identifies this manifest. Principally used to refer to the manifest in non-FHIR contexts.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "masterIdentifier")]
    pub master_identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_masterIdentifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub master_identifier_ext: Option<FieldExtension>,
    /** **Other identifiers for the manifest**

 Other identifiers associated with the document manifest, including version independent  identifiers.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[DocumentReferenceStatus](http://hl7.org/fhir/ValueSet/document-reference-status); current | superseded | entered-in-error**

 The status of this document manifest.

 This element is labeled as a modifier because the status contains the codes that mark the manifest as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::DocumentReferenceStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[DocumentC80Type](http://hl7.org/fhir/ValueSet/c80-doc-typecodes); Kind of document set**

 Specifies the kind of this set of documents (e.g. Patient Summary, Discharge Summary, Prescription, etc.). The type of a set of documents may be the same as one of the documents in it - especially if there is only one - but it may be wider.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **The subject of the set of documents**

 Who or what the set of documents is about. The documents can be about a person, (patient or healthcare practitioner), a device (i.e. machine) or even a group of subjects (such as a document about a herd of farm animals, or a set of patients that share a common exposure). If the documents cross more than one subject, then more than one subject is allowed here (unusual use case).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **When this document manifest created**

 When the document manifest was created for submission to the server (not necessarily the same thing as the actual resource last modified time, since it may be modified, replicated, etc.).

 Creation time is used for tracking, organizing versions and searching. This is the creation time of the document set, not the documents on which it is based. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "created")]
    pub created: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_created")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub created_ext: Option<FieldExtension>,
    /** **Who and/or what authored the manifest**

 Identifies who is responsible for creating the manifest, and adding  documents to it.

 Not necessarily who did the actual data entry (i.e. typist) or who was the source (informant). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_author")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub author_ext: Vec<Option<FieldExtension>>,
    /** **Intended to get notified about this set of documents**

 A patient, practitioner, or organization for which this set of documents is intended.

 How the recipient receives the document set or is notified of it is up to the implementation. This element is just a statement of intent. If the recipient is a person, and it is not known whether the person is a patient or a practitioner, RelatedPerson would be the default choice. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recipient")]
    pub recipient: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_recipient")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub recipient_ext: Vec<Option<FieldExtension>>,
    /** **The source system/application/software**

 Identifies the source system, application, or software that produced the document manifest.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "source")]
    pub source: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_source")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_ext: Option<FieldExtension>,
    /** **Human-readable description (title)**

 Human-readable description of the source document. This is sometimes known as the "title".

 What the document is about, rather than a terse summary of the document. It is commonly the case that records do not have a title and are collectively referred to by the display name of Record code (e.g. a "consultation" or "progress note"). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **The items included**

 The list of Documents included in the manifest.

 */
    #[serde(rename = "content")]
    pub content: Vec<Option<DocumentManifestContent>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_content")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub content_ext: Vec<Option<FieldExtension>>,
    /** **Related things**

 Related identifiers or resources associated with the DocumentManifest.

 May be identifiers or resources that caused the DocumentManifest to be created. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "related")]
    pub related: Vec<Option<DocumentManifestRelated>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_related")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub related_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl DocumentManifestBuilder {
    #[doc = concat!("Finalize building ", "DocumentManifest", ".")]
    pub fn build(self) -> Result<DocumentManifest, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<DocumentManifestInner> for DocumentManifest {
    fn from(inner: DocumentManifestInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for DocumentManifest {
    type Target = DocumentManifestInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for DocumentManifest {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl DocumentManifest {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> DocumentManifestBuilder {
        DocumentManifestBuilder::default()
    }
}
impl DocumentManifest {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::DocumentManifest
    }
}
/// Sub-fields of the content field in DocumentManifest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DocumentManifestContentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DocumentManifestContent {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Contents of this set of documents**

 The list of references to document content, or Attachment that consist of the parts of this document manifest. Usually, these would be document references, but direct references to Media or Attachments are also allowed.

 The intended focus of the DocumentManifest is for the reference to target either DocumentReference or Media Resources, and most implementation guides will restrict to these resources. The reference is to "Any" to support EN 13606 usage, where an extract is DocumentManifest that references  List and Composition resources. */
    #[serde(flatten)]
    pub p: DocumentManifestContentP,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub p_ext: Option<DocumentManifestContentPExtension>,
}
#[cfg(feature = "builders")]
impl DocumentManifestContent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DocumentManifestContentBuilder {
        DocumentManifestContentBuilder::default()
    }
}
/// Choice of types for the p[x] field in DocumentManifestContent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DocumentManifestContentP {
    /// Variant accepting the Attachment type.
    #[serde(rename = "pAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Reference type.
    #[serde(rename = "pReference")]
    Reference(Reference),
}
/// Extension value for DocumentManifestContentP.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum DocumentManifestContentPExtension {
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_pAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_pReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the related field in DocumentManifest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DocumentManifestRelatedBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DocumentManifestRelated {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Identifiers of things that are related**

 Related identifier to this DocumentManifest.  For example, Order numbers, accession numbers, XDW workflow numbers.

 If both identifier and ref elements are present they shall refer to the same thing. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **Related Resource**

 Related Resource to this DocumentManifest. For example, Order, ProcedureRequest,  Procedure, EligibilityRequest, etc.

 If both identifier and ref elements are present they shall refer to the same thing. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "ref")]
    pub r#ref: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_ref")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#ref_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl DocumentManifestRelated {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DocumentManifestRelatedBuilder {
        DocumentManifestRelatedBuilder::default()
    }
}
/** Base StructureDefinition for DocumentReference Resource

 **[DocumentReference](http://hl7.org/fhir/StructureDefinition/DocumentReference) v3.0.2**

 A reference to a document

 A reference to a document.

 Usually, this is used for documents other than those defined by FHIR. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct DocumentReference(pub Box<DocumentReferenceInner>);
/** Base StructureDefinition for DocumentReference Resource

 **[DocumentReference](http://hl7.org/fhir/StructureDefinition/DocumentReference) v3.0.2**

 A reference to a document

 A reference to a document.

 Usually, this is used for documents other than those defined by FHIR. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DocumentReferenceBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct DocumentReferenceInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "DocumentReference::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::DocumentReference", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Master Version Specific Identifier**

 Document identifier as assigned by the source of the document. This identifier is specific to this version of the document. This unique identifier may be used elsewhere to identify this version of the document.

 CDA Document Id extension and root. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "masterIdentifier")]
    pub master_identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_masterIdentifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub master_identifier_ext: Option<FieldExtension>,
    /** **Other identifiers for the document**

 Other identifiers associated with the document, including version independent identifiers.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[DocumentReferenceStatus](http://hl7.org/fhir/ValueSet/document-reference-status); current | superseded | entered-in-error**

 The status of this document reference.

 This is the status of the DocumentReference object, which might be independent from the docStatus element.

This element is labeled as a modifier because the status contains the codes that mark the document or reference as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::DocumentReferenceStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[ReferredDocumentStatus](http://hl7.org/fhir/ValueSet/composition-status); preliminary | final | appended | amended | entered-in-error**

 The status of the underlying document.

 The document that is pointed to might be in various lifecycle states. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "docStatus")]
    pub doc_status: Option<codes::CompositionStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_docStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub doc_status_ext: Option<FieldExtension>,
    /** **[DocumentC80Type](http://hl7.org/fhir/ValueSet/c80-doc-typecodes); Kind of document (LOINC if possible)**

 Specifies the particular kind of document referenced  (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the document referenced.

 Key metadata element describing the document, used in searching/filtering. */
    #[serde(rename = "type")]
    pub r#type: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[DocumentC80Class](http://hl7.org/fhir/ValueSet/c80-doc-classcodes); Categorization of document**

 A categorization for the type of document referenced - helps for indexing and searching. This may be implied by or derived from the code specified in the DocumentReference.type.

 This is a metadata field from [XDS/MHD](http://wiki.ihe.net/index.php?title=Mobile_access_to_Health_Documents_(MHD)). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "class")]
    pub class: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_class")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub class_ext: Option<FieldExtension>,
    /** **Who/what is the subject of the document**

 Who or what the document is about. The document can be about a person, (patient or healthcare practitioner), a device (e.g. a machine) or even a group of subjects (such as a document about a herd of farm animals, or a set of patients that share a common exposure).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Document creation time**

 When the document was created.

 Creation time is used for tracking, organizing versions and searching. This is the creation time of the document, not the source material on which it is based. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "created")]
    pub created: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_created")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub created_ext: Option<FieldExtension>,
    /** **When this document reference was created**

 When the document reference was created.

 Referencing/indexing time is used for tracking, organizing versions and searching. */
    #[serde(rename = "indexed")]
    pub indexed: Instant,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_indexed")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub indexed_ext: Option<FieldExtension>,
    /** **Who and/or what authored the document**

 Identifies who is responsible for adding the information to the document.

 Not necessarily who did the actual data entry (i.e. typist) it in or who was the source (informant). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_author")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub author_ext: Vec<Option<FieldExtension>>,
    /** **Who/what authenticated the document**

 Which person or organization authenticates that this document is valid.

 Represents a participant within the author institution who has legally authenticated or attested the document. Legal authentication implies that a document has been signed manually or electronically by the legal Authenticator. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authenticator")]
    pub authenticator: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_authenticator")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub authenticator_ext: Option<FieldExtension>,
    /** **Organization which maintains the document**

 Identifies the organization or group who is responsible for ongoing maintenance of and access to the document.

 Identifies the logical organization to go to find the current version, where to report issues, etc. This is different from the physical location of the document, which is the technical location of the document, which host may be delegated to the management of some other organization. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "custodian")]
    pub custodian: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_custodian")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub custodian_ext: Option<FieldExtension>,
    /** **Relationships to other documents**

 Relationships that this document has with other document references that already exist.

 This element is labeled as a modifier because documents that append to other documents are incomplete on their own. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relatesTo")]
    pub relates_to: Vec<Option<DocumentReferenceRelatesTo>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_relatesTo")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub relates_to_ext: Vec<Option<FieldExtension>>,
    /** **Human-readable description (title)**

 Human-readable description of the source document. This is sometimes known as the "title".

 What the document is about, rather than a terse summary of the document. It is commonly the case that records do not have a title and are collectively referred to by the display name of Record code (e.g. a "consultation" or "progress note"). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **[SecurityLabels](http://hl7.org/fhir/ValueSet/security-labels); Document security-tags**

 A set of Security-Tag codes specifying the level of privacy/security of the Document. Note that DocumentReference.meta.security contains the security labels of the "reference" to the document, while DocumentReference.securityLabel contains a snapshot of the security labels on the document the reference refers to.

 The confidentiality codes can carry multiple vocabulary items. HL7 has developed an understanding of security and privacy tags that might be desirable in a Document Sharing environment, called HL7 Healthcare Privacy and Security Classification System (HCS). The following specification is recommended but not mandated, as the vocabulary bindings are an administrative domain responsibility. The use of this method is up to the policy domain such as the XDS Affinity Domain or other Trust Domain where all parties including sender and recipients are trusted to appropriately tag and enforce.   In the HL7 Healthcare Privacy and Security Classification (HCS) there are code systems specific to Confidentiality, Sensitivity, Integrity, and Handling Caveats. Some values would come from a local vocabulary as they are related to workflow roles and special projects. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "securityLabel")]
    pub security_label: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_securityLabel")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub security_label_ext: Vec<Option<FieldExtension>>,
    /** **Document referenced**

 The document and format referenced. There may be multiple content element repetitions, each with a different format.

 */
    #[serde(rename = "content")]
    pub content: Vec<Option<DocumentReferenceContent>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_content")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub content_ext: Vec<Option<FieldExtension>>,
    /** **Clinical context of document**

 The clinical context in which the document was prepared.

 These values are primarily added to help with searching for interesting/relevant documents. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<DocumentReferenceContext>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl DocumentReferenceBuilder {
    #[doc = concat!("Finalize building ", "DocumentReference", ".")]
    pub fn build(self) -> Result<DocumentReference, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<DocumentReferenceInner> for DocumentReference {
    fn from(inner: DocumentReferenceInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for DocumentReference {
    type Target = DocumentReferenceInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for DocumentReference {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl DocumentReference {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> DocumentReferenceBuilder {
        DocumentReferenceBuilder::default()
    }
}
impl DocumentReference {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::DocumentReference
    }
}
/// Sub-fields of the relatesTo field in DocumentReference
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DocumentReferenceRelatesToBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DocumentReferenceRelatesTo {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DocumentRelationshipType](http://hl7.org/fhir/ValueSet/document-relationship-type); replaces | transforms | signs | appends**

 The type of relationship that this document has with anther document.

 If this document appends another document, then the document cannot be fully understood without also accessing the referenced document. */
    #[serde(rename = "code")]
    pub code: codes::DocumentRelationshipType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Target of the relationship**

 The target document of this relationship.

 */
    #[serde(rename = "target")]
    pub target: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_target")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub target_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl DocumentReferenceRelatesTo {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DocumentReferenceRelatesToBuilder {
        DocumentReferenceRelatesToBuilder::default()
    }
}
/// Sub-fields of the content field in DocumentReference
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DocumentReferenceContentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DocumentReferenceContent {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Where to access the document**

 The document or URL of the document along with critical metadata to prove content has integrity.

 */
    #[serde(rename = "attachment")]
    pub attachment: Attachment,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_attachment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub attachment_ext: Option<FieldExtension>,
    /** **[DocumentFormat](http://hl7.org/fhir/ValueSet/formatcodes); Format/content rules for the document**

 An identifier of the document encoding, structure, and template that the document conforms to beyond the base format indicated in the mimeType.

 Note that while IHE mostly issues URNs for format types, not all documents can be identified by a URI. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "format")]
    pub format: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_format")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub format_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl DocumentReferenceContent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DocumentReferenceContentBuilder {
        DocumentReferenceContentBuilder::default()
    }
}
/// Sub-fields of the context field in DocumentReference
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DocumentReferenceContextBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DocumentReferenceContext {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Context of the document  content**

 Describes the clinical encounter or type of care that the document content is associated with.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "encounter")]
    pub encounter: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_encounter")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub encounter_ext: Option<FieldExtension>,
    /** **[DocumentEventType](http://hl7.org/fhir/ValueSet/v3-ActCode); Main clinical acts documented**

 This list of codes represents the main clinical acts, such as a colonoscopy or an appendectomy, being documented. In some cases, the event is inherent in the typeCode, such as a "History and Physical Report" in which the procedure being documented is necessarily a "History and Physical" act.

 An event can further specialize the act inherent in the type, such as  where it is simply "Procedure Report" and the procedure was a "colonoscopy". If one or more event codes are included, they shall not conflict with the values inherent in the class or type elements as such a conflict would create an ambiguous situation. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "event")]
    pub event: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_event")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub event_ext: Vec<Option<FieldExtension>>,
    /** **Time of service that is being documented**

 The time period over which the service that is described by the document was provided.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
    /** **[DocumentC80FacilityType](http://hl7.org/fhir/ValueSet/c80-facilitycodes); Kind of facility where patient was seen**

 The kind of facility where the patient was seen.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "facilityType")]
    pub facility_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_facilityType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub facility_type_ext: Option<FieldExtension>,
    /** **[DocumentC80PracticeSetting](http://hl7.org/fhir/ValueSet/c80-practice-codes); Additional details about where the content was created (e.g. clinical specialty)**

 This property may convey specifics about the practice setting where the content was created, often reflecting the clinical specialty.

 The value set for this content has an example binding because it is a value set decided by community policy. Other examples exist for consideration: * HITSP created the table HITSP/C80 Table 2-148 Clinical Specialty Value Set (a value set based upon SNOMED CT which is referenced by Direct (XDR and XDM for Direct Messaging Specification, Version 1), as well as Nationwide Health Information Network (NHIN).  Query for Documents, Web Service Interface Specification, V 3.0, 07/27/2011 * ELGA (Austria) (ELGA CDA Implementie-rungsleitfäden Registrierung von CDA Dokumenten für ELGA mit IHE Cross-Enterprise Document Sharing: XDS Metadaten (XDSDocumentEntry), [1.2.40.0.34.7.6.3] * XDS Connect-a-thon practiceSettingCode. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "practiceSetting")]
    pub practice_setting: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_practiceSetting")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub practice_setting_ext: Option<FieldExtension>,
    /** **Patient demographics from source**

 The Patient Information as known when the document was published. May be a reference to a version specific, or contained.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sourcePatientInfo")]
    pub source_patient_info: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sourcePatientInfo")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_patient_info_ext: Option<FieldExtension>,
    /** **Related identifiers or resources**

 Related identifiers or resources associated with the DocumentReference.

 May be identifiers or resources that caused the DocumentReference or referenced Document to be created. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "related")]
    pub related: Vec<Option<DocumentReferenceContextRelated>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_related")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub related_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl DocumentReferenceContext {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DocumentReferenceContextBuilder {
        DocumentReferenceContextBuilder::default()
    }
}
/// Sub-fields of the related field in DocumentReferenceContext
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "DocumentReferenceContextRelatedBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct DocumentReferenceContextRelated {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Identifier of related objects or events**

 Related identifier to this DocumentReference. If both id and ref are present they shall refer to the same thing.

 Order numbers, accession numbers, XDW workflow numbers. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **Related Resource**

 Related Resource to this DocumentReference. If both id and ref are present they shall refer to the same thing.

 Order, ProcedureRequest,  Procedure, EligibilityRequest, etc. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "ref")]
    pub r#ref: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_ref")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#ref_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl DocumentReferenceContextRelated {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> DocumentReferenceContextRelatedBuilder {
        DocumentReferenceContextRelatedBuilder::default()
    }
}
/** Base StructureDefinition for EligibilityRequest Resource

 **[EligibilityRequest](http://hl7.org/fhir/StructureDefinition/EligibilityRequest) v3.0.2**

 Determine insurance validity and scope of coverage

 The EligibilityRequest provides patient and insurance coverage information to an insurer for them to respond, in the form of an EligibilityResponse, with information regarding whether the stated coverage is valid and in-force and optionally to provide the insurance details of the policy.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct EligibilityRequest(pub Box<EligibilityRequestInner>);
/** Base StructureDefinition for EligibilityRequest Resource

 **[EligibilityRequest](http://hl7.org/fhir/StructureDefinition/EligibilityRequest) v3.0.2**

 Determine insurance validity and scope of coverage

 The EligibilityRequest provides patient and insurance coverage information to an insurer for them to respond, in the form of an EligibilityResponse, with information regarding whether the stated coverage is valid and in-force and optionally to provide the insurance details of the policy.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EligibilityRequestBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct EligibilityRequestInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "EligibilityRequest::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::EligibilityRequest", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business Identifier**

 The Response business identifier.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[EligibilityRequestStatus](http://hl7.org/fhir/ValueSet/fm-status); active | cancelled | draft | entered-in-error**

 The status of the resource instance.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[ProcessPriority](http://hl7.org/fhir/ValueSet/process-priority); Desired processing priority**

 Immediate (STAT), best effort (NORMAL), deferred (DEFER).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "priority")]
    pub priority: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_priority")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub priority_ext: Option<FieldExtension>,
    /** **The subject of the Products and Services**

 Patient Resource.

 1..1. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patient")]
    pub patient: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_ext: Option<FieldExtension>,
    /** **Estimated date or dates of Service**

 The date or dates when the enclosed suite of services were performed or completed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub serviced: Option<EligibilityRequestServiced>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub serviced_ext: Option<EligibilityRequestServicedExtension>,
    /** **Creation date**

 The date when this resource was created.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "created")]
    pub created: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_created")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub created_ext: Option<FieldExtension>,
    /** **Author**

 Person who created the invoice/claim/pre-determination or pre-authorization.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "enterer")]
    pub enterer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_enterer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub enterer_ext: Option<FieldExtension>,
    /** **Responsible practitioner**

 The practitioner who is responsible for the services rendered to the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "provider")]
    pub provider: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_provider")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub provider_ext: Option<FieldExtension>,
    /** **Responsible organization**

 The organization which is responsible for the services rendered to the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "organization")]
    pub organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_organization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub organization_ext: Option<FieldExtension>,
    /** **Target**

 The Insurer who is target  of the request.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "insurer")]
    pub insurer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_insurer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub insurer_ext: Option<FieldExtension>,
    /** **Servicing Facility**

 Facility where the services were provided.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "facility")]
    pub facility: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_facility")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub facility_ext: Option<FieldExtension>,
    /** **Insurance or medical plan**

 Financial instrument by which payment information for health care.

 1..1. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "coverage")]
    pub coverage: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_coverage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub coverage_ext: Option<FieldExtension>,
    /** **Business agreement**

 The contract number of a business agreement which describes the terms and conditions.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "businessArrangement")]
    pub business_arrangement: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_businessArrangement")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub business_arrangement_ext: Option<FieldExtension>,
    /** **[BenefitCategory](http://hl7.org/fhir/ValueSet/benefit-category); Type of services covered**

 Dental, Vision, Medical, Pharmacy, Rehab etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "benefitCategory")]
    pub benefit_category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_benefitCategory")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub benefit_category_ext: Option<FieldExtension>,
    /** **[BenefitSubCategory](http://hl7.org/fhir/ValueSet/benefit-subcategory); Detailed services covered within the type**

 Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "benefitSubCategory")]
    pub benefit_sub_category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_benefitSubCategory")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub benefit_sub_category_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl EligibilityRequestBuilder {
    #[doc = concat!("Finalize building ", "EligibilityRequest", ".")]
    pub fn build(self) -> Result<EligibilityRequest, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<EligibilityRequestInner> for EligibilityRequest {
    fn from(inner: EligibilityRequestInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for EligibilityRequest {
    type Target = EligibilityRequestInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for EligibilityRequest {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl EligibilityRequest {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> EligibilityRequestBuilder {
        EligibilityRequestBuilder::default()
    }
}
impl EligibilityRequest {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::EligibilityRequest
    }
}
/// Choice of types for the serviced[x] field in EligibilityRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EligibilityRequestServiced {
    /// Variant accepting the Date type.
    #[serde(rename = "servicedDate")]
    Date(Date),
    /// Variant accepting the Period type.
    #[serde(rename = "servicedPeriod")]
    Period(Period),
}
/// Extension value for EligibilityRequestServiced.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EligibilityRequestServicedExtension {
    /// Variant accepting the Date extension.
    #[serde(rename = "_servicedDate")]
    Date(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_servicedPeriod")]
    Period(FieldExtension),
}
/** Base StructureDefinition for EligibilityResponse Resource

 **[EligibilityResponse](http://hl7.org/fhir/StructureDefinition/EligibilityResponse) v3.0.2**

 EligibilityResponse resource

 This resource provides eligibility and plan details from the processing of an Eligibility resource.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct EligibilityResponse(pub Box<EligibilityResponseInner>);
/** Base StructureDefinition for EligibilityResponse Resource

 **[EligibilityResponse](http://hl7.org/fhir/StructureDefinition/EligibilityResponse) v3.0.2**

 EligibilityResponse resource

 This resource provides eligibility and plan details from the processing of an Eligibility resource.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EligibilityResponseBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct EligibilityResponseInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "EligibilityResponse::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::EligibilityResponse", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business Identifier**

 The Response business identifier.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[EligibilityResponseStatus](http://hl7.org/fhir/ValueSet/fm-status); active | cancelled | draft | entered-in-error**

 The status of the resource instance.

 This element is labeled as a modifier because the status contains codes that mark the response as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **Creation date**

 The date when the enclosed suite of services were performed or completed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "created")]
    pub created: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_created")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub created_ext: Option<FieldExtension>,
    /** **Responsible practitioner**

 The practitioner who is responsible for the services rendered to the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requestProvider")]
    pub request_provider: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requestProvider")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_provider_ext: Option<FieldExtension>,
    /** **Responsible organization**

 The organization which is responsible for the services rendered to the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requestOrganization")]
    pub request_organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requestOrganization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_organization_ext: Option<FieldExtension>,
    /** **Eligibility reference**

 Original request resource reference.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "request")]
    pub request: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_request")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_ext: Option<FieldExtension>,
    /** **[RemittanceOutcome](http://hl7.org/fhir/ValueSet/remittance-outcome); complete | error | partial**

 Transaction status: error, complete.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "outcome")]
    pub outcome: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_outcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub outcome_ext: Option<FieldExtension>,
    /** **Disposition Message**

 A description of the status of the adjudication.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "disposition")]
    pub disposition: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_disposition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub disposition_ext: Option<FieldExtension>,
    /** **Insurer issuing the coverage**

 The Insurer who produced this adjudicated response.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "insurer")]
    pub insurer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_insurer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub insurer_ext: Option<FieldExtension>,
    /** **Coverage inforce indicator**

 Flag indicating if the coverage provided is inforce currently  if no service date(s) specified or for the whole duration of the service dates.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "inforce")]
    pub inforce: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_inforce")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub inforce_ext: Option<FieldExtension>,
    /** **Details by insurance coverage**

 The insurer may provide both the details for the requested coverage as well as details for additional coverages known to the insurer.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "insurance")]
    pub insurance: Vec<Option<EligibilityResponseInsurance>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_insurance")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub insurance_ext: Vec<Option<FieldExtension>>,
    /** **[Forms](http://hl7.org/fhir/ValueSet/forms); Printed Form Identifier**

 The form to be used for printing the content.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "form")]
    pub form: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_form")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub form_ext: Option<FieldExtension>,
    /** **Processing errors**

 Mutually exclusive with Services Provided (Item).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "error")]
    pub error: Vec<Option<EligibilityResponseError>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_error")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub error_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl EligibilityResponseBuilder {
    #[doc = concat!("Finalize building ", "EligibilityResponse", ".")]
    pub fn build(self) -> Result<EligibilityResponse, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<EligibilityResponseInner> for EligibilityResponse {
    fn from(inner: EligibilityResponseInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for EligibilityResponse {
    type Target = EligibilityResponseInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for EligibilityResponse {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl EligibilityResponse {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> EligibilityResponseBuilder {
        EligibilityResponseBuilder::default()
    }
}
impl EligibilityResponse {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::EligibilityResponse
    }
}
/// Sub-fields of the insurance field in EligibilityResponse
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EligibilityResponseInsuranceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EligibilityResponseInsurance {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Updated Coverage details**

 A suite of updated or additional Coverages from the Insurer.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "coverage")]
    pub coverage: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_coverage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub coverage_ext: Option<FieldExtension>,
    /** **Contract details**

 The contract resource which may provide more detailed information.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contract")]
    pub contract: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_contract")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub contract_ext: Option<FieldExtension>,
    /** **Benefits by Category**

 Benefits and optionally current balances by Category.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "benefitBalance")]
    pub benefit_balance: Vec<Option<EligibilityResponseInsuranceBenefitBalance>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_benefitBalance")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub benefit_balance_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl EligibilityResponseInsurance {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EligibilityResponseInsuranceBuilder {
        EligibilityResponseInsuranceBuilder::default()
    }
}
/// Sub-fields of the benefitBalance field in EligibilityResponseInsurance
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EligibilityResponseInsuranceBenefitBalanceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EligibilityResponseInsuranceBenefitBalance {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[BenefitCategory](http://hl7.org/fhir/ValueSet/benefit-category); Type of services covered**

 Dental, Vision, Medical, Pharmacy, Rehab etc.

 */
    #[serde(rename = "category")]
    pub category: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[BenefitSubCategory](http://hl7.org/fhir/ValueSet/benefit-subcategory); Detailed services covered within the type**

 Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subCategory")]
    pub sub_category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subCategory")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sub_category_ext: Option<FieldExtension>,
    /** **Excluded from the plan**

 True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "excluded")]
    pub excluded: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_excluded")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub excluded_ext: Option<FieldExtension>,
    /** **Short name for the benefit**

 A short name or tag for the benefit, for example MED01, or DENT2.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Description of the benefit or services covered**

 A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **[BenefitNetwork](http://hl7.org/fhir/ValueSet/benefit-network); In or out of network**

 Network designation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "network")]
    pub network: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_network")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub network_ext: Option<FieldExtension>,
    /** **[BenefitUnit](http://hl7.org/fhir/ValueSet/benefit-unit); Individual or family**

 Unit designation: individual or family.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "unit")]
    pub unit: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_unit")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub unit_ext: Option<FieldExtension>,
    /** **[BenefitTerm](http://hl7.org/fhir/ValueSet/benefit-term); Annual or lifetime**

 The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "term")]
    pub term: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_term")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub term_ext: Option<FieldExtension>,
    /** **Benefit Summary**

 Benefits Used to date.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "financial")]
    pub financial: Vec<Option<EligibilityResponseInsuranceBenefitBalanceFinancial>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_financial")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub financial_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl EligibilityResponseInsuranceBenefitBalance {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EligibilityResponseInsuranceBenefitBalanceBuilder {
        EligibilityResponseInsuranceBenefitBalanceBuilder::default()
    }
}
/// Sub-fields of the financial field in EligibilityResponseInsuranceBenefitBalance
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EligibilityResponseInsuranceBenefitBalanceFinancialBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EligibilityResponseInsuranceBenefitBalanceFinancial {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[BenefitType](http://hl7.org/fhir/ValueSet/benefit-type); Deductable, visits, benefit amount**

 Deductable, visits, benefit amount.

 */
    #[serde(rename = "type")]
    pub r#type: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Benefits allowed**

 Benefits allowed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub allowed: Option<EligibilityResponseInsuranceBenefitBalanceFinancialAllowed>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub allowed_ext: Option<
        EligibilityResponseInsuranceBenefitBalanceFinancialAllowedExtension,
    >,
    /** **Benefits used**

 Benefits used.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub used: Option<EligibilityResponseInsuranceBenefitBalanceFinancialUsed>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub used_ext: Option<
        EligibilityResponseInsuranceBenefitBalanceFinancialUsedExtension,
    >,
}
#[cfg(feature = "builders")]
impl EligibilityResponseInsuranceBenefitBalanceFinancial {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EligibilityResponseInsuranceBenefitBalanceFinancialBuilder {
        EligibilityResponseInsuranceBenefitBalanceFinancialBuilder::default()
    }
}
/// Choice of types for the allowed[x] field in EligibilityResponseInsuranceBenefitBalanceFinancial
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EligibilityResponseInsuranceBenefitBalanceFinancialAllowed {
    /// Variant accepting the UnsignedInt type.
    #[serde(rename = "allowedUnsignedInt")]
    UnsignedInt(u32),
    /// Variant accepting the String type.
    #[serde(rename = "allowedString")]
    String(String),
    /// Variant accepting the Money type.
    #[serde(rename = "allowedMoney")]
    Money(Money),
}
/// Extension value for EligibilityResponseInsuranceBenefitBalanceFinancialAllowed.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EligibilityResponseInsuranceBenefitBalanceFinancialAllowedExtension {
    /// Variant accepting the UnsignedInt extension.
    #[serde(rename = "_allowedUnsignedInt")]
    UnsignedInt(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_allowedString")]
    String(FieldExtension),
    /// Variant accepting the Money extension.
    #[serde(rename = "_allowedMoney")]
    Money(FieldExtension),
}
/// Choice of types for the used[x] field in EligibilityResponseInsuranceBenefitBalanceFinancial
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EligibilityResponseInsuranceBenefitBalanceFinancialUsed {
    /// Variant accepting the UnsignedInt type.
    #[serde(rename = "usedUnsignedInt")]
    UnsignedInt(u32),
    /// Variant accepting the Money type.
    #[serde(rename = "usedMoney")]
    Money(Money),
}
/// Extension value for EligibilityResponseInsuranceBenefitBalanceFinancialUsed.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum EligibilityResponseInsuranceBenefitBalanceFinancialUsedExtension {
    /// Variant accepting the UnsignedInt extension.
    #[serde(rename = "_usedUnsignedInt")]
    UnsignedInt(FieldExtension),
    /// Variant accepting the Money extension.
    #[serde(rename = "_usedMoney")]
    Money(FieldExtension),
}
/// Sub-fields of the error field in EligibilityResponse
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EligibilityResponseErrorBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EligibilityResponseError {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[AdjudicationError](http://hl7.org/fhir/ValueSet/adjudication-error); Error code detailing processing issues**

 An error code,from a specified code system, which details why the eligibility check could not be performed.

 */
    #[serde(rename = "code")]
    pub code: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl EligibilityResponseError {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EligibilityResponseErrorBuilder {
        EligibilityResponseErrorBuilder::default()
    }
}
/** Base StructureDefinition for Encounter Resource

 **[Encounter](http://hl7.org/fhir/StructureDefinition/Encounter) v3.0.2**

 An interaction during which services are provided to the patient

 An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Encounter(pub Box<EncounterInner>);
/** Base StructureDefinition for Encounter Resource

 **[Encounter](http://hl7.org/fhir/StructureDefinition/Encounter) v3.0.2**

 An interaction during which services are provided to the patient

 An interaction between a patient and healthcare provider(s) for the purpose of providing healthcare service(s) or assessing the health status of a patient.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EncounterBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct EncounterInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Encounter::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Encounter", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Identifier(s) by which this encounter is known**

 Identifier(s) by which this encounter is known.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[EncounterStatus](http://hl7.org/fhir/ValueSet/encounter-status); planned | arrived | triaged | in-progress | onleave | finished | cancelled +**

 planned | arrived | triaged | in-progress | onleave | finished | cancelled +.

 Note that internal business rules will detemine the appropraite transitions that may occur between statuses (and also classes).

This element is labeled as a modifier because the status contains codes that mark the encounter as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::EncounterStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **List of past encounter statuses**

 The status history permits the encounter resource to contain the status history without needing to read through the historical versions of the resource, or even have the server store them.

 The current status is always found in the current version of the resource, not the status history. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "statusHistory")]
    pub status_history: Vec<Option<EncounterStatusHistory>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_statusHistory")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub status_history_ext: Vec<Option<FieldExtension>>,
    /** **[EncounterClass](http://hl7.org/fhir/ValueSet/v3-ActEncounterCode); inpatient | outpatient | ambulatory | emergency +**

 inpatient | outpatient | ambulatory | emergency +.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "class")]
    pub class: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_class")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub class_ext: Option<FieldExtension>,
    /** **List of past encounter classes**

 The class history permits the tracking of the encounters transitions without needing to go  through the resource history.

This would be used for a case where an admission starts of as an emergency encounter, then transisions into an inpatient scenario. Doing this and not restarting a new encounter ensures that any lab/diagnostic results can more easily follow the patient and not require re-processing and not get lost or cancelled during a kindof discharge from emergency to inpatient.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "classHistory")]
    pub class_history: Vec<Option<EncounterClassHistory>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_classHistory")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub class_history_ext: Vec<Option<FieldExtension>>,
    /** **[EncounterType](http://hl7.org/fhir/ValueSet/encounter-type); Specific type of encounter**

 Specific type of encounter (e.g. e-mail consultation, surgical day-care, skilled nursing, rehabilitation).

 Since there are many ways to further classify encounters, this element is 0..*. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub r#type_ext: Vec<Option<FieldExtension>>,
    /** **[Priority](http://hl7.org/fhir/ValueSet/v3-ActPriority); Indicates the urgency of the encounter**

 Indicates the urgency of the encounter.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "priority")]
    pub priority: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_priority")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub priority_ext: Option<FieldExtension>,
    /** **The patient ro group present at the encounter**

 The patient ro group present at the encounter.

 While the encounter is always about the patient, the patient may not actually be known in all contexts of use, and there may be a group of patients that could be anonymous (such as in a group therapy for Alcoholics Anonymous - where the recording of the encounter could be used for billing on the number of people/staff and not important to the context of the specific patients) or alternately in veterinary care a herd of sheep receiving treatment (where the animals are not individually tracked). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Episode(s) of care that this encounter should be recorded against**

 Where a specific encounter should be classified as a part of a specific episode(s) of care this field should be used. This association can facilitate grouping of related encounters together for a specific purpose, such as government reporting, issue tracking, association via a common problem.  The association is recorded on the encounter as these are typically created after the episode of care, and grouped on entry rather than editing the episode of care to append another encounter to it (the episode of care could span years).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "episodeOfCare")]
    pub episode_of_care: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_episodeOfCare")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub episode_of_care_ext: Vec<Option<FieldExtension>>,
    /** **The ReferralRequest that initiated this encounter**

 The referral request this encounter satisfies (incoming referral).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "incomingReferral")]
    pub incoming_referral: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_incomingReferral")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub incoming_referral_ext: Vec<Option<FieldExtension>>,
    /** **List of participants involved in the encounter**

 The list of people responsible for providing the service.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "participant")]
    pub participant: Vec<Option<EncounterParticipant>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_participant")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub participant_ext: Vec<Option<FieldExtension>>,
    /** **The appointment that scheduled this encounter**

 The appointment that scheduled this encounter.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "appointment")]
    pub appointment: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_appointment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub appointment_ext: Option<FieldExtension>,
    /** **The start and end time of the encounter**

 The start and end time of the encounter.

 If not (yet) known, the end of the Period may be omitted. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
    /** **Quantity of time the encounter lasted (less time absent)**

 Quantity of time the encounter lasted. This excludes the time during leaves of absence.

 May differ from the time the Encounter.period lasted because of leave of absence. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "length")]
    pub length: Option<Duration>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_length")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub length_ext: Option<FieldExtension>,
    /** **[EncounterReason](http://hl7.org/fhir/ValueSet/encounter-reason); Reason the encounter takes place (code)**

 Reason the encounter takes place, expressed as a code. For admissions, this can be used for a coded admission diagnosis.

 For systems that need to know which was the primary diagnosis, these will be marked with the standard extension primaryDiagnosis (which is a sequence value rather than a flag, 1 = primary diagnosis). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reason")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_ext: Vec<Option<FieldExtension>>,
    /** **The list of diagnosis relevant to this encounter**

 The list of diagnosis relevant to this encounter.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "diagnosis")]
    pub diagnosis: Vec<Option<EncounterDiagnosis>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_diagnosis")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub diagnosis_ext: Vec<Option<FieldExtension>>,
    /** **The set of accounts that may be used for billing for this Encounter**

 The set of accounts that may be used for billing for this Encounter.

 The billing system may choose to allocate billable items associated with the Encounter to different referenced Accounts based on internal business rules. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "account")]
    pub account: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_account")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub account_ext: Vec<Option<FieldExtension>>,
    /** **Details about the admission to a healthcare service**

 Details about the admission to a healthcare service.

 An Encounter may cover more than just the inpatient stay. Contexts such as outpatients, community clinics, and aged care facilities are also included.

The duration recorded in the period of this encounter covers the entire scope of this hospitalization record. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "hospitalization")]
    pub hospitalization: Option<EncounterHospitalization>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_hospitalization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub hospitalization_ext: Option<FieldExtension>,
    /** **List of locations where the patient has been**

 List of locations where  the patient has been during this encounter.

 Virtual encounters can be recorded in the Encounter by specifying a location reference to a location of type "kind" such as "client's home" and an encounter.class = "virtual". */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "location")]
    pub location: Vec<Option<EncounterLocation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_location")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub location_ext: Vec<Option<FieldExtension>>,
    /** **The custodian organization of this Encounter record**

 An organization that is in charge of maintaining the information of this Encounter (e.g. who maintains the report or the master service catalog item, etc.). This MAY be the same as the organization on the Patient record, however it could be different. This MAY not be not the Service Delivery Location's Organization.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "serviceProvider")]
    pub service_provider: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_serviceProvider")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub service_provider_ext: Option<FieldExtension>,
    /** **Another Encounter this encounter is part of**

 Another Encounter of which this encounter is a part of (administratively or in time).

 This is also used for associating a child's encounter back to the mother's encounter.

Refer to the Notes section in the Patient resource for further details. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "partOf")]
    pub part_of: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_partOf")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub part_of_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl EncounterBuilder {
    #[doc = concat!("Finalize building ", "Encounter", ".")]
    pub fn build(self) -> Result<Encounter, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<EncounterInner> for Encounter {
    fn from(inner: EncounterInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Encounter {
    type Target = EncounterInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Encounter {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Encounter {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> EncounterBuilder {
        EncounterBuilder::default()
    }
}
impl Encounter {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Encounter
    }
}
/// Sub-fields of the statusHistory field in Encounter
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EncounterStatusHistoryBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EncounterStatusHistory {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[EncounterStatus](http://hl7.org/fhir/ValueSet/encounter-status); planned | arrived | triaged | in-progress | onleave | finished | cancelled +**

 planned | arrived | triaged | in-progress | onleave | finished | cancelled +.

 */
    #[serde(rename = "status")]
    pub status: codes::EncounterStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **The time that the episode was in the specified status**

 The time that the episode was in the specified status.

 */
    #[serde(rename = "period")]
    pub period: Period,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl EncounterStatusHistory {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EncounterStatusHistoryBuilder {
        EncounterStatusHistoryBuilder::default()
    }
}
/// Sub-fields of the classHistory field in Encounter
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EncounterClassHistoryBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EncounterClassHistory {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[EncounterClass](http://hl7.org/fhir/ValueSet/v3-ActEncounterCode); inpatient | outpatient | ambulatory | emergency +**

 inpatient | outpatient | ambulatory | emergency +.

 */
    #[serde(rename = "class")]
    pub class: Coding,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_class")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub class_ext: Option<FieldExtension>,
    /** **The time that the episode was in the specified class**

 The time that the episode was in the specified class.

 */
    #[serde(rename = "period")]
    pub period: Period,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl EncounterClassHistory {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EncounterClassHistoryBuilder {
        EncounterClassHistoryBuilder::default()
    }
}
/// Sub-fields of the participant field in Encounter
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EncounterParticipantBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EncounterParticipant {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ParticipantType](http://hl7.org/fhir/ValueSet/encounter-participant-type); Role of participant in encounter**

 Role of participant in encounter.

 The participant type indicates how an individual partitipates in an encounter. It includes non-practitioner participants, and for practitioners this is to describe the action type in the context of this encounter (e.g. Admitting Dr, Attending Dr, Translator, Consulting Dr). This is different to the practitioner roles which are functional roles, derived from terms of employment, education, licensing, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub r#type_ext: Vec<Option<FieldExtension>>,
    /** **Period of time during the encounter that the participant participated**

 The period of time that the specified participant participated in the encounter. These can overlap or be sub-sets of the overall encounter's period.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
    /** **Persons involved in the encounter other than the patient**

 Persons involved in the encounter other than the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "individual")]
    pub individual: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_individual")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub individual_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl EncounterParticipant {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EncounterParticipantBuilder {
        EncounterParticipantBuilder::default()
    }
}
/// Sub-fields of the diagnosis field in Encounter
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EncounterDiagnosisBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EncounterDiagnosis {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Reason the encounter takes place (resource)**

 Reason the encounter takes place, as specified using information from another resource. For admissions, this is the admission diagnosis. The indication will typically be a Condition (with other resources referenced in the evidence.detail), or a Procedure.

 For systems that need to know which was the primary diagnosis, these will be marked with the standard extension primaryDiagnosis (which is a sequence value rather than a flag, 1 = primary diagnosis). */
    #[serde(rename = "condition")]
    pub condition: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_condition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub condition_ext: Option<FieldExtension>,
    /** **[DiagnosisRole](http://hl7.org/fhir/ValueSet/diagnosis-role); Role that this diagnosis has within the encounter (e.g. admission, billing, discharge …)**

 Role that this diagnosis has within the encounter (e.g. admission, billing, discharge …).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "role")]
    pub role: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_role")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub role_ext: Option<FieldExtension>,
    /** **Ranking of the diagnosis (for each role type)**

 Ranking of the diagnosis (for each role type).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "rank")]
    pub rank: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_rank")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub rank_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl EncounterDiagnosis {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EncounterDiagnosisBuilder {
        EncounterDiagnosisBuilder::default()
    }
}
/// Sub-fields of the hospitalization field in Encounter
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EncounterHospitalizationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EncounterHospitalization {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Pre-admission identifier**

 Pre-admission identifier.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "preAdmissionIdentifier")]
    pub pre_admission_identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_preAdmissionIdentifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub pre_admission_identifier_ext: Option<FieldExtension>,
    /** **The location from which the patient came before admission**

 The location from which the patient came before admission.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "origin")]
    pub origin: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_origin")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub origin_ext: Option<FieldExtension>,
    /** **[AdmitSource](http://hl7.org/fhir/ValueSet/encounter-admit-source); From where patient was admitted (physician referral, transfer)**

 From where patient was admitted (physician referral, transfer).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "admitSource")]
    pub admit_source: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_admitSource")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub admit_source_ext: Option<FieldExtension>,
    /** **[ReAdmissionType](http://hl7.org/fhir/ValueSet/v2-0092); The type of hospital re-admission that has occurred (if any). If the value is absent, then this is not identified as a readmission**

 Whether this hospitalization is a readmission and why if known.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reAdmission")]
    pub re_admission: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reAdmission")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub re_admission_ext: Option<FieldExtension>,
    /** **[PatientDiet](http://hl7.org/fhir/ValueSet/encounter-diet); Diet preferences reported by the patient**

 Diet preferences reported by the patient.

 For example a patient may request both a dairy-free and nut-free diet preference (not mutually exclusive). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dietPreference")]
    pub diet_preference: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_dietPreference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub diet_preference_ext: Vec<Option<FieldExtension>>,
    /** **[Courtesies](http://hl7.org/fhir/ValueSet/encounter-special-courtesy); Special courtesies (VIP, board member)**

 Special courtesies (VIP, board member).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "specialCourtesy")]
    pub special_courtesy: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_specialCourtesy")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub special_courtesy_ext: Vec<Option<FieldExtension>>,
    /** **[Arrangements](http://hl7.org/fhir/ValueSet/encounter-special-arrangements); Wheelchair, translator, stretcher, etc.**

 Any special requests that have been made for this hospitalization encounter, such as the provision of specific equipment or other things.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "specialArrangement")]
    pub special_arrangement: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_specialArrangement")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub special_arrangement_ext: Vec<Option<FieldExtension>>,
    /** **Location to which the patient is discharged**

 Location to which the patient is discharged.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "destination")]
    pub destination: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_destination")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub destination_ext: Option<FieldExtension>,
    /** **[DischargeDisp](http://hl7.org/fhir/ValueSet/encounter-discharge-disposition); Category or kind of location after discharge**

 Category or kind of location after discharge.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dischargeDisposition")]
    pub discharge_disposition: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_dischargeDisposition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub discharge_disposition_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl EncounterHospitalization {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EncounterHospitalizationBuilder {
        EncounterHospitalizationBuilder::default()
    }
}
/// Sub-fields of the location field in Encounter
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EncounterLocationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EncounterLocation {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Location the encounter takes place**

 The location where the encounter takes place.

 */
    #[serde(rename = "location")]
    pub location: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_location")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub location_ext: Option<FieldExtension>,
    /** **[EncounterLocationStatus](http://hl7.org/fhir/ValueSet/encounter-location-status); planned | active | reserved | completed**

 The status of the participants' presence at the specified location during the period specified. If the participant is is no longer at the location, then the period will have an end date/time.

 When the patient is no longer active at a location, then the period end date is entered, and the status may be changed to completed. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<codes::EncounterLocationStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **Time period during which the patient was present at the location**

 Time period during which the patient was present at the location.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl EncounterLocation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EncounterLocationBuilder {
        EncounterLocationBuilder::default()
    }
}
/** Base StructureDefinition for Endpoint Resource

 **[Endpoint](http://hl7.org/fhir/StructureDefinition/Endpoint) v3.0.2**

 The technical details of an endpoint that can be used for electronic services

 The technical details of an endpoint that can be used for electronic services, such as for web services providing XDS.b or a REST endpoint for another FHIR server. This may include any security context information.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Endpoint(pub Box<EndpointInner>);
/** Base StructureDefinition for Endpoint Resource

 **[Endpoint](http://hl7.org/fhir/StructureDefinition/Endpoint) v3.0.2**

 The technical details of an endpoint that can be used for electronic services

 The technical details of an endpoint that can be used for electronic services, such as for web services providing XDS.b or a REST endpoint for another FHIR server. This may include any security context information.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EndpointBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct EndpointInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Endpoint::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Endpoint", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Identifies this endpoint across multiple systems**

 Identifier for the organization that is used to identify the endpoint across multiple disparate systems.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[EndpointStatus](http://hl7.org/fhir/ValueSet/endpoint-status); active | suspended | error | off | entered-in-error | test**

 active | suspended | error | off | test.

 This element is labeled as a modifier because the status contains codes that mark the endpoint as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::EndpointStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[endpoint-contype](http://hl7.org/fhir/ValueSet/endpoint-connection-type); Protocol/Profile/Standard to be used with this endpoint connection**

 A coded value that represents the technical details of the usage of this endpoint, such as what WSDLs should be used in what way. (e.g. XDS.b/DICOM/cds-hook).

 For additional connectivity details for the protocol, extensions will be used at this point, as in the XDS example. */
    #[serde(rename = "connectionType")]
    pub connection_type: Coding,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_connectionType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub connection_type_ext: Option<FieldExtension>,
    /** **A name that this endpoint can be identified by**

 A friendly name that this endpoint can be referred to with.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Organization that manages this endpoint (may not be the organization that exposes the endpoint)**

 The organization that manages this endpoint (even if technically another organisation is hosting this in the cloud, it is the organisation associated with the data).

 This property is not typically used when searching for Endpoint resources for usage. The typical usage is via the reference from an aplicable Organization/Location/Practitioner resource, which is where the context is provided. Multiple Locations may reference a single endpoint, and don't have to be within the same organization resource, but most likely within the same organizational hierarchy. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "managingOrganization")]
    pub managing_organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_managingOrganization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub managing_organization_ext: Option<FieldExtension>,
    /** **Contact details for source (e.g. troubleshooting)**

 Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactPoint>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Interval the endpoint is expected to be operational**

 The interval during which the endpoint is expected to be operational.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
    /** **[PayloadType](http://hl7.org/fhir/ValueSet/endpoint-payload-type); The type of content that may be used at this endpoint (e.g. XDS Discharge summaries)**

 The payload type describes the acceptable content that can be communicated on the endpoint.

 The payloadFormat describes the serialization format of the data, where the payloadType indicates the specific document/schema that is being transferred; e.g. DischargeSummary or CarePlan. */
    #[serde(rename = "payloadType")]
    pub payload_type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_payloadType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub payload_type_ext: Vec<Option<FieldExtension>>,
    /** **[MimeType](http://www.rfc-editor.org/bcp/bcp13.txt); Mimetype to send. If not specified, the content could be anything (including no payload, if the connectionType defined this)**

 The mime type to send the payload in - e.g. application/fhir+xml, application/fhir+json. If the mime type is not specified, then the sender could send any content (including no content depending on the connectionType).

 Sending the payload has obvious security consequences. The server is responsible for ensuring that the content is appropriately secured. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "payloadMimeType")]
    pub payload_mime_type: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_payloadMimeType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub payload_mime_type_ext: Vec<Option<FieldExtension>>,
    /** **The technical base address for connecting to this endpoint**

 The uri that describes the actual end-point to connect to.

 For rest-hook, and websocket, the end-point must be an http: or https: URL; for email, a mailto: url, for sms, a tel: url, and for message the endpoint can be in any form of url the server understands (usually, http: or mllp:). The URI is allowed to be relative; in which case, it is relative to the server end-point (since their may be more than one, clients should avoid using relative URIs)

This address will be to the service base, without any parameters, or sub-services or resources tacked on.

E.g. for a WADO-RS endpoint, the url should be "https://pacs.hospital.org/wado-rs"

and not "https://pacs.hospital.org/wado-rs/studies/1.2.250.1.59.40211.12345678.678910/series/1.2.250.1.59.40211.789001276.14556172.67789/instances/...". */
    #[serde(rename = "address")]
    pub address: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_address")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub address_ext: Option<FieldExtension>,
    /** **Usage depends on the channel type**

 Additional headers / information to send as part of the notification.

 Exactly what these mean depend on the channel type. The can convey additional information to the recipient and/or meet security requirements. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "header")]
    pub header: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_header")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub header_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl EndpointBuilder {
    #[doc = concat!("Finalize building ", "Endpoint", ".")]
    pub fn build(self) -> Result<Endpoint, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<EndpointInner> for Endpoint {
    fn from(inner: EndpointInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Endpoint {
    type Target = EndpointInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Endpoint {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Endpoint {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> EndpointBuilder {
        EndpointBuilder::default()
    }
}
impl Endpoint {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Endpoint
    }
}
/** Base StructureDefinition for EnrollmentRequest Resource

 **[EnrollmentRequest](http://hl7.org/fhir/StructureDefinition/EnrollmentRequest) v3.0.2**

 Enrollment request

 This resource provides the insurance enrollment details to the insurer regarding a specified coverage.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct EnrollmentRequest(pub Box<EnrollmentRequestInner>);
/** Base StructureDefinition for EnrollmentRequest Resource

 **[EnrollmentRequest](http://hl7.org/fhir/StructureDefinition/EnrollmentRequest) v3.0.2**

 Enrollment request

 This resource provides the insurance enrollment details to the insurer regarding a specified coverage.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EnrollmentRequestBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct EnrollmentRequestInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "EnrollmentRequest::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::EnrollmentRequest", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business Identifier**

 The Response business identifier.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[EnrollmentRequestStatus](http://hl7.org/fhir/ValueSet/fm-status); active | cancelled | draft | entered-in-error**

 The status of the resource instance.

 This element is labeled as a modifier because the status contains codes that mark the request as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **Creation date**

 The date when this resource was created.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "created")]
    pub created: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_created")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub created_ext: Option<FieldExtension>,
    /** **Target**

 The Insurer who is target  of the request.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "insurer")]
    pub insurer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_insurer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub insurer_ext: Option<FieldExtension>,
    /** **Responsible practitioner**

 The practitioner who is responsible for the services rendered to the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "provider")]
    pub provider: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_provider")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub provider_ext: Option<FieldExtension>,
    /** **Responsible organization**

 The organization which is responsible for the services rendered to the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "organization")]
    pub organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_organization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub organization_ext: Option<FieldExtension>,
    /** **The subject of the Products and Services**

 Patient Resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Insurance information**

 Reference to the program or plan identification, underwriter or payor.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "coverage")]
    pub coverage: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_coverage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub coverage_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl EnrollmentRequestBuilder {
    #[doc = concat!("Finalize building ", "EnrollmentRequest", ".")]
    pub fn build(self) -> Result<EnrollmentRequest, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<EnrollmentRequestInner> for EnrollmentRequest {
    fn from(inner: EnrollmentRequestInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for EnrollmentRequest {
    type Target = EnrollmentRequestInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for EnrollmentRequest {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl EnrollmentRequest {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> EnrollmentRequestBuilder {
        EnrollmentRequestBuilder::default()
    }
}
impl EnrollmentRequest {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::EnrollmentRequest
    }
}
/** Base StructureDefinition for EnrollmentResponse Resource

 **[EnrollmentResponse](http://hl7.org/fhir/StructureDefinition/EnrollmentResponse) v3.0.2**

 EnrollmentResponse resource

 This resource provides enrollment and plan details from the processing of an Enrollment resource.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct EnrollmentResponse(pub Box<EnrollmentResponseInner>);
/** Base StructureDefinition for EnrollmentResponse Resource

 **[EnrollmentResponse](http://hl7.org/fhir/StructureDefinition/EnrollmentResponse) v3.0.2**

 EnrollmentResponse resource

 This resource provides enrollment and plan details from the processing of an Enrollment resource.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EnrollmentResponseBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct EnrollmentResponseInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "EnrollmentResponse::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::EnrollmentResponse", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business Identifier**

 The Response business identifier.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[EnrollmentResponseStatus](http://hl7.org/fhir/ValueSet/fm-status); active | cancelled | draft | entered-in-error**

 The status of the resource instance.

 This element is labeled as a modifier because the status contains codes that mark the response as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **Claim reference**

 Original request resource reference.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "request")]
    pub request: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_request")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_ext: Option<FieldExtension>,
    /** **[RemittanceOutcome](http://hl7.org/fhir/ValueSet/remittance-outcome); complete | error | partial**

 Processing status: error, complete.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "outcome")]
    pub outcome: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_outcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub outcome_ext: Option<FieldExtension>,
    /** **Disposition Message**

 A description of the status of the adjudication.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "disposition")]
    pub disposition: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_disposition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub disposition_ext: Option<FieldExtension>,
    /** **Creation date**

 The date when the enclosed suite of services were performed or completed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "created")]
    pub created: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_created")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub created_ext: Option<FieldExtension>,
    /** **Insurer**

 The Insurer who produced this adjudicated response.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "organization")]
    pub organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_organization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub organization_ext: Option<FieldExtension>,
    /** **Responsible practitioner**

 The practitioner who is responsible for the services rendered to the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requestProvider")]
    pub request_provider: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requestProvider")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_provider_ext: Option<FieldExtension>,
    /** **Responsible organization**

 The organization which is responsible for the services rendered to the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requestOrganization")]
    pub request_organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requestOrganization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_organization_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl EnrollmentResponseBuilder {
    #[doc = concat!("Finalize building ", "EnrollmentResponse", ".")]
    pub fn build(self) -> Result<EnrollmentResponse, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<EnrollmentResponseInner> for EnrollmentResponse {
    fn from(inner: EnrollmentResponseInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for EnrollmentResponse {
    type Target = EnrollmentResponseInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for EnrollmentResponse {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl EnrollmentResponse {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> EnrollmentResponseBuilder {
        EnrollmentResponseBuilder::default()
    }
}
impl EnrollmentResponse {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::EnrollmentResponse
    }
}
/** Base StructureDefinition for EpisodeOfCare Resource

 **[EpisodeOfCare](http://hl7.org/fhir/StructureDefinition/EpisodeOfCare) v3.0.2**

 An association of a Patient with an Organization and  Healthcare Provider(s) for a period of time that the Organization assumes some level of responsibility

 An association between a patient and an organization / healthcare provider(s) during which time encounters may occur. The managing organization assumes a level of responsibility for the patient during this time.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct EpisodeOfCare(pub Box<EpisodeOfCareInner>);
/** Base StructureDefinition for EpisodeOfCare Resource

 **[EpisodeOfCare](http://hl7.org/fhir/StructureDefinition/EpisodeOfCare) v3.0.2**

 An association of a Patient with an Organization and  Healthcare Provider(s) for a period of time that the Organization assumes some level of responsibility

 An association between a patient and an organization / healthcare provider(s) during which time encounters may occur. The managing organization assumes a level of responsibility for the patient during this time.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EpisodeOfCareBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct EpisodeOfCareInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "EpisodeOfCare::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::EpisodeOfCare", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business Identifier(s) relevant for this EpisodeOfCare**

 The EpisodeOfCare may be known by different identifiers for different contexts of use, such as when an external agency is tracking the Episode for funding purposes.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[EpisodeOfCareStatus](http://hl7.org/fhir/ValueSet/episode-of-care-status); planned | waitlist | active | onhold | finished | cancelled | entered-in-error**

 planned | waitlist | active | onhold | finished | cancelled.

 This element is labeled as a modifier because the status contains codes that mark the episode as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::EpisodeOfCareStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **Past list of status codes (the current status may be included to cover the start date of the status)**

 The history of statuses that the EpisodeOfCare has been through (without requiring processing the history of the resource).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "statusHistory")]
    pub status_history: Vec<Option<EpisodeOfCareStatusHistory>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_statusHistory")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub status_history_ext: Vec<Option<FieldExtension>>,
    /** **[EpisodeOfCareType](http://hl7.org/fhir/ValueSet/episodeofcare-type); Type/class  - e.g. specialist referral, disease management**

 A classification of the type of episode of care; e.g. specialist referral, disease management, type of funded care.

 The type can be very important in processing as this could be used in determining if the EpisodeOfCare is relevant to specific government reporting, or other types of classifications. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub r#type_ext: Vec<Option<FieldExtension>>,
    /** **The list of diagnosis relevant to this episode of care**

 The list of diagnosis relevant to this episode of care.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "diagnosis")]
    pub diagnosis: Vec<Option<EpisodeOfCareDiagnosis>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_diagnosis")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub diagnosis_ext: Vec<Option<FieldExtension>>,
    /** **The patient who is the focus of this episode of care**

 The patient who is the focus of this episode of care.

 */
    #[serde(rename = "patient")]
    pub patient: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_ext: Option<FieldExtension>,
    /** **Organization that assumes care**

 The organization that has assumed the specific responsibilities for the specified duration.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "managingOrganization")]
    pub managing_organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_managingOrganization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub managing_organization_ext: Option<FieldExtension>,
    /** **Interval during responsibility is assumed**

 The interval during which the managing organization assumes the defined responsibility.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
    /** **Originating Referral Request(s)**

 Referral Request(s) that are fulfilled by this EpisodeOfCare, incoming referrals.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "referralRequest")]
    pub referral_request: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_referralRequest")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub referral_request_ext: Vec<Option<FieldExtension>>,
    /** **Care manager/care co-ordinator for the patient**

 The practitioner that is the care manager/care co-ordinator for this patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "careManager")]
    pub care_manager: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_careManager")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub care_manager_ext: Option<FieldExtension>,
    /** **Other practitioners facilitating this episode of care**

 The list of practitioners that may be facilitating this episode of care for specific purposes.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "team")]
    pub team: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_team")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub team_ext: Vec<Option<FieldExtension>>,
    /** **The set of accounts that may be used for billing for this EpisodeOfCare**

 The set of accounts that may be used for billing for this EpisodeOfCare.

 The billing system may choose to allocate billable items associated with the EpisodeOfCare to different referenced Accounts based on internal business rules. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "account")]
    pub account: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_account")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub account_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl EpisodeOfCareBuilder {
    #[doc = concat!("Finalize building ", "EpisodeOfCare", ".")]
    pub fn build(self) -> Result<EpisodeOfCare, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<EpisodeOfCareInner> for EpisodeOfCare {
    fn from(inner: EpisodeOfCareInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for EpisodeOfCare {
    type Target = EpisodeOfCareInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for EpisodeOfCare {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl EpisodeOfCare {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> EpisodeOfCareBuilder {
        EpisodeOfCareBuilder::default()
    }
}
impl EpisodeOfCare {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::EpisodeOfCare
    }
}
/// Sub-fields of the statusHistory field in EpisodeOfCare
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EpisodeOfCareStatusHistoryBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EpisodeOfCareStatusHistory {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[EpisodeOfCareStatus](http://hl7.org/fhir/ValueSet/episode-of-care-status); planned | waitlist | active | onhold | finished | cancelled | entered-in-error**

 planned | waitlist | active | onhold | finished | cancelled.

 */
    #[serde(rename = "status")]
    pub status: codes::EpisodeOfCareStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **Duration the EpisodeOfCare was in the specified status**

 The period during this EpisodeOfCare that the specific status applied.

 */
    #[serde(rename = "period")]
    pub period: Period,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl EpisodeOfCareStatusHistory {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EpisodeOfCareStatusHistoryBuilder {
        EpisodeOfCareStatusHistoryBuilder::default()
    }
}
/// Sub-fields of the diagnosis field in EpisodeOfCare
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "EpisodeOfCareDiagnosisBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct EpisodeOfCareDiagnosis {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Conditions/problems/diagnoses this episode of care is for**

 A list of conditions/problems/diagnoses that this episode of care is intended to be providing care for.

 */
    #[serde(rename = "condition")]
    pub condition: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_condition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub condition_ext: Option<FieldExtension>,
    /** **[DiagnosisRole](http://hl7.org/fhir/ValueSet/diagnosis-role); Role that this diagnosis has within the episode of care (e.g. admission, billing, discharge …)**

 Role that this diagnosis has within the episode of care (e.g. admission, billing, discharge …).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "role")]
    pub role: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_role")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub role_ext: Option<FieldExtension>,
    /** **Ranking of the diagnosis (for each role type)**

 Ranking of the diagnosis (for each role type).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "rank")]
    pub rank: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_rank")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub rank_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl EpisodeOfCareDiagnosis {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> EpisodeOfCareDiagnosisBuilder {
        EpisodeOfCareDiagnosisBuilder::default()
    }
}
/** Base StructureDefinition for ExpansionProfile Resource

 **[ExpansionProfile](http://hl7.org/fhir/StructureDefinition/ExpansionProfile) v3.0.2**

 Defines behaviour and contraints on the ValueSet Expansion operation

 Resource to define constraints on the Expansion of a FHIR ValueSet.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ExpansionProfile(pub Box<ExpansionProfileInner>);
/** Base StructureDefinition for ExpansionProfile Resource

 **[ExpansionProfile](http://hl7.org/fhir/StructureDefinition/ExpansionProfile) v3.0.2**

 Defines behaviour and contraints on the ValueSet Expansion operation

 Resource to define constraints on the Expansion of a FHIR ValueSet.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExpansionProfileBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ExpansionProfileInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ExpansionProfile::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ExpansionProfile", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical URI to reference this expansion profile (globally unique)**

 An absolute URI that is used to identify this expansion profile when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this expansion profile is (or will be) published. The URL SHOULD include the major version of the expansion profile. For more information see [Technical and Business Versions](resource.html#versions).

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred.  Multiple instances may share the same url if they have a distinct version. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "url")]
    pub url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Additional identifier for the expansion profile**

 A formal identifier that is used to identify this expansion profile when it is represented in other formats, or referenced in a specification, model, design or an instance.

 Typically, this is used for identifiers that can go in an HL7 V3 II (instance identifier) data type, e.g., to identify this expansion profile outside of FHIR, where it is not possible to use the logical URI. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **Business version of the expansion profile**

 The identifier that is used to identify this version of the expansion profile when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the expansion profile author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.

 There may be different expansion profile instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a refrence to a particular business version of the expansion profile with the format [url]|[version]. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Name for this expansion profile (computer friendly)**

 A natural language name identifying the expansion profile. This name should be usable as an identifier for the module by machine processing applications such as code generation.

 The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure that it is computable friendly. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this expansion profile. Enables tracking the life-cycle of the content.

 Allows filtering of expansion profiles that are appropriate for use vs. not.
This is labeled as "Is Modifier" because applications should not use a retired expansion profile without due consideration. */
    #[serde(rename = "status")]
    pub status: codes::PublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **For testing purposes, not real usage**

 A boolean value to indicate that this expansion profile is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of expansion profile that are appropriate for use vs. not. This is labeled as "Is Modifier" because applications should not use an experimental expansion profile in production. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "experimental")]
    pub experimental: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_experimental")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub experimental_ext: Option<FieldExtension>,
    /** **Date this was last changed**

 The date  (and optionally time) when the expansion profile was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the expansion profile changes.

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the expansion profile. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Name of the publisher (organization or individual)**

 The name of the individual or organization that published the expansion profile.

 Usually an organization, but may be an individual. The publisher (or steward) of the expansion profile is the organization or individual primarily responsible for the maintenance and upkeep of the expansion profile. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the expansion profile. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisher")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_ext: Option<FieldExtension>,
    /** **Contact details for the publisher**

 Contact details to assist a user in finding and communicating with the publisher.

 May be a web site, an email address, a telephone number, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Natural language description of the expansion profile**

 A free text natural language description of the expansion profile from a consumer's perspective.

 This description can be used to capture details such as why the expansion profile was built, comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the expansion profile as conveyed in the 'text' field of the resource itself. This item SHOULD be populated unless the information is available from context (e.g. the language of the profile is presumed to be the predominant language in the place the profile was created). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Context the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate expansion profile instances.

 When multiple useContexts are specified, there is no expectation whether all or any of the contexts apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useContext")]
    pub use_context: Vec<Option<UsageContext>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_useContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_context_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Intended jurisdiction for expansion profile (if applicable)**

 A legal or geographic region in which the expansion profile is intended to be used.

 It may be possible for the expansion profile to be used in jurisdictions other than those for which it was originally designed or intended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **Fix use of a code system to a particular version**

 Fix use of a particular code system to a particular version.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "fixedVersion")]
    pub fixed_version: Vec<Option<ExpansionProfileFixedVersion>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_fixedVersion")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub fixed_version_ext: Vec<Option<FieldExtension>>,
    /** **Systems/Versions to be exclude**

 Code system, or a particular version of a code system to be excluded from value set expansions.

 When a system is excluded, and this makes a material difference to the expansion, the exclusion SHALL  be noted in the expansion parameters using a parameter 'excluded'. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "excludedSystem")]
    pub excluded_system: Option<ExpansionProfileExcludedSystem>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_excludedSystem")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub excluded_system_ext: Option<FieldExtension>,
    /** **Whether the expansion should include concept designations**

 Controls whether concept designations are to be included or excluded in value set expansions.

 ExpansionProfile.designation.include and ExpansionProfile.designation.exclude are only evaluated if includeDesignations is present and set to "true". If includeDesignations is present with a value of "true" and both ExpansionProfile.designation.include and ExpansionProfile.designation.exclude are absent, then all designations are returned in the expansion. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "includeDesignations")]
    pub include_designations: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_includeDesignations")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub include_designations_ext: Option<FieldExtension>,
    /** **When the expansion profile imposes designation contraints**

 A set of criteria that provide the constraints imposed on the value set expansion by including or excluding designations.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "designation")]
    pub designation: Option<ExpansionProfileDesignation>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_designation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub designation_ext: Option<FieldExtension>,
    /** **Include or exclude the value set definition in the expansion**

 Controls whether the value set definition is included or excluded in value set expansions.

 The ValueSet defintion refers to all fields in the ValueSet definition apart from  ValueSet.contains. The definition is only included if includeDefinition is present and has a value of "true". */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "includeDefinition")]
    pub include_definition: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_includeDefinition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub include_definition_ext: Option<FieldExtension>,
    /** **Include or exclude inactive concepts in the expansion**

 Controls whether inactive concepts are included or excluded in value set expansions.

 Inactive codes are included if activeOnly is present and has a value of "true". Note that if the value set explicitly specifies that inactive codes are included, this property can still remove them from a specific expansion, but this parameter cannot include them if the value set excludes them. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "activeOnly")]
    pub active_only: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_activeOnly")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub active_only_ext: Option<FieldExtension>,
    /** **Nested codes in the expansion or not**

 Controls whether or not the value set expansion nests codes or not (i.e. ValueSet.expansion.contains.contains).

 Nesting of codes is excluded if excludeNested is present and has a value of "true". */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "excludeNested")]
    pub exclude_nested: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_excludeNested")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub exclude_nested_ext: Option<FieldExtension>,
    /** **Include or exclude codes which cannot be rendered in user interfaces in the value set expansion**

 Controls whether or not the value set expansion includes codes which cannot be displayed in user interfaces.

 Codes which cannot be used in user interfaces will be excluded if excludeNotForUI is present and has a value of "true". */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "excludeNotForUI")]
    pub exclude_not_for_ui: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_excludeNotForUI")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub exclude_not_for_ui_ext: Option<FieldExtension>,
    /** **Include or exclude codes which are post coordinated expressions in the value set expansion**

 Controls whether or not the value set expansion includes post coordinated codes.

 Post coordinated codes are excluded if excludePostCoordinated is present and has a value of "true". */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "excludePostCoordinated")]
    pub exclude_post_coordinated: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_excludePostCoordinated")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub exclude_post_coordinated_ext: Option<FieldExtension>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Specify the language for the display element of codes in the value set expansion**

 Specifies the language to be used for description in the expansions i.e. the language to be used for ValueSet.expansion.contains.display.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "displayLanguage")]
    pub display_language: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_displayLanguage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub display_language_ext: Option<FieldExtension>,
    /** **Controls behaviour of the value set expand operation when value sets are too large to be completely expanded**

 If the value set being expanded is incomplete (because it is too big to expand), return a limited expansion (a subset) with an indicator that expansion is incomplete, using the extension [http://hl7.org/fhir/StructureDefinition/valueset-toocostly](extension-valueset-toocostly.html).

 This field overides the default behaviour (which is to return an error). This does not apply to expansions which are unbounded. Clients SHALL process the extension [http://hl7.org/fhir/StructureDefinition/valueset-toocostly](extension-valueset-toocostly.html) correctly if limitedExpansion = true. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "limitedExpansion")]
    pub limited_expansion: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_limitedExpansion")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub limited_expansion_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ExpansionProfileBuilder {
    #[doc = concat!("Finalize building ", "ExpansionProfile", ".")]
    pub fn build(self) -> Result<ExpansionProfile, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ExpansionProfileInner> for ExpansionProfile {
    fn from(inner: ExpansionProfileInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ExpansionProfile {
    type Target = ExpansionProfileInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ExpansionProfile {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ExpansionProfile {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ExpansionProfileBuilder {
        ExpansionProfileBuilder::default()
    }
}
impl ExpansionProfile {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ExpansionProfile
    }
}
/// Sub-fields of the fixedVersion field in ExpansionProfile
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExpansionProfileFixedVersionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExpansionProfileFixedVersion {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **System to have its version fixed**

 The specific system for which to fix the version.

 See ''Coding.system'' for further documentation. */
    #[serde(rename = "system")]
    pub system: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_system")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub system_ext: Option<FieldExtension>,
    /** **Specific version of the code system referred to**

 The version of the code system from which codes in the expansion should be included.

 */
    #[serde(rename = "version")]
    pub version: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **[SystemVersionProcessingMode](http://hl7.org/fhir/ValueSet/system-version-processing-mode); default | check | override**

 How to manage the intersection between a fixed version in a value set, and this fixed version of the system in the expansion profile.

 */
    #[serde(rename = "mode")]
    pub mode: codes::SystemVersionProcessingMode,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_mode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub mode_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ExpansionProfileFixedVersion {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExpansionProfileFixedVersionBuilder {
        ExpansionProfileFixedVersionBuilder::default()
    }
}
/// Sub-fields of the excludedSystem field in ExpansionProfile
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExpansionProfileExcludedSystemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExpansionProfileExcludedSystem {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **The specific code system to be excluded**

 An absolute URI which is the code system to be excluded.

 See ''Coding.system'' for further documentation. */
    #[serde(rename = "system")]
    pub system: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_system")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub system_ext: Option<FieldExtension>,
    /** **Specific version of the code system referred to**

 The version of the code system from which codes in the expansion should be excluded.

 This is used to apply version specifc exclusion contraints. If no version is specified, then all codes from the code system present in the expansion (prior to application of the expansion profile) will be excluded. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ExpansionProfileExcludedSystem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExpansionProfileExcludedSystemBuilder {
        ExpansionProfileExcludedSystemBuilder::default()
    }
}
/// Sub-fields of the designation field in ExpansionProfile
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExpansionProfileDesignationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExpansionProfileDesignation {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Designations to be included**

 Designations to be included.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "include")]
    pub include: Option<ExpansionProfileDesignationInclude>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_include")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub include_ext: Option<FieldExtension>,
    /** **Designations to be excluded**

 Designations to be excluded.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "exclude")]
    pub exclude: Option<ExpansionProfileDesignationExclude>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_exclude")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub exclude_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ExpansionProfileDesignation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExpansionProfileDesignationBuilder {
        ExpansionProfileDesignationBuilder::default()
    }
}
/// Sub-fields of the include field in ExpansionProfileDesignation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExpansionProfileDesignationIncludeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExpansionProfileDesignationInclude {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **The designation to be included**

 A data group for each designation to be included.

 At least one of designation.language or designation.use must be provided for each include.designation element. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "designation")]
    pub designation: Vec<Option<ExpansionProfileDesignationIncludeDesignation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_designation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub designation_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ExpansionProfileDesignationInclude {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExpansionProfileDesignationIncludeBuilder {
        ExpansionProfileDesignationIncludeBuilder::default()
    }
}
/// Sub-fields of the designation field in ExpansionProfileDesignationInclude
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExpansionProfileDesignationIncludeDesignationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExpansionProfileDesignationIncludeDesignation {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Human language of the designation to be included**

 The language this designation is defined for.

 In the absence of a language, all designations are retained which match the designation.use parameter for this include.designation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_language")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub language_ext: Option<FieldExtension>,
    /** **[ConceptDesignationUse](http://hl7.org/fhir/ValueSet/designation-use); What kind of Designation to include**

 Which kinds of designation to include in the expansion.

 In the absence of a use, all designations are retained which match the designation.language parameter for this include.designation element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "use")]
    pub r#use: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_use")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#use_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ExpansionProfileDesignationIncludeDesignation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExpansionProfileDesignationIncludeDesignationBuilder {
        ExpansionProfileDesignationIncludeDesignationBuilder::default()
    }
}
/// Sub-fields of the exclude field in ExpansionProfileDesignation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExpansionProfileDesignationExcludeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExpansionProfileDesignationExclude {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **The designation to be excluded**

 A data group for each designation to be excluded.

 At least one of designation.language or designation.use must be provided for each exclude.designation element. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "designation")]
    pub designation: Vec<Option<ExpansionProfileDesignationExcludeDesignation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_designation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub designation_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ExpansionProfileDesignationExclude {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExpansionProfileDesignationExcludeBuilder {
        ExpansionProfileDesignationExcludeBuilder::default()
    }
}
/// Sub-fields of the designation field in ExpansionProfileDesignationExclude
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExpansionProfileDesignationExcludeDesignationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExpansionProfileDesignationExcludeDesignation {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Human language of the designation to be excluded**

 The language this designation is defined for.

 In the absence of a language, all designations are excluded which match the designation.use parameter for this exclude.designation element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_language")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub language_ext: Option<FieldExtension>,
    /** **[ConceptDesignationUse](http://hl7.org/fhir/ValueSet/designation-use); What kind of Designation to exclude**

 Which kinds of designation to exclude from the expansion.

 In the absence of a use, all designations are retained which match the designation.language parameter for this exclude.designation element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "use")]
    pub r#use: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_use")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#use_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ExpansionProfileDesignationExcludeDesignation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExpansionProfileDesignationExcludeDesignationBuilder {
        ExpansionProfileDesignationExcludeDesignationBuilder::default()
    }
}
/** Base StructureDefinition for ExplanationOfBenefit Resource

 **[ExplanationOfBenefit](http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit) v3.0.2**

 Explanation of Benefit resource

 This resource provides: the claim details; adjudication details from the processing of a Claim; and optionally account balance information, for informing the subscriber of the benefits provided.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ExplanationOfBenefit(pub Box<ExplanationOfBenefitInner>);
/** Base StructureDefinition for ExplanationOfBenefit Resource

 **[ExplanationOfBenefit](http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit) v3.0.2**

 Explanation of Benefit resource

 This resource provides: the claim details; adjudication details from the processing of a Claim; and optionally account balance information, for informing the subscriber of the benefits provided.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExplanationOfBenefitBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ExplanationOfBenefitInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ExplanationOfBenefit::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ExplanationOfBenefit", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business Identifier**

 The EOB Business Identifier.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[ExplanationOfBenefitStatus](http://hl7.org/fhir/ValueSet/explanationofbenefit-status); active | cancelled | draft | entered-in-error**

 The status of the resource instance.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<codes::ExplanationOfBenefitStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[ClaimType](http://hl7.org/fhir/ValueSet/claim-type); Type or discipline**

 The category of claim, eg, oral, pharmacy, vision, insitutional, professional.

 Affects which fields and value sets are used. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[ClaimSubType](http://hl7.org/fhir/ValueSet/claim-subtype); Finer grained claim type information**

 A finer grained suite of claim subtype codes which may convey Inpatient vs Outpatient and/or a specialty service. In the US the BillType.

 This may contain the local bill type codes such as the US UB-04 bill type code. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subType")]
    pub sub_type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub sub_type_ext: Vec<Option<FieldExtension>>,
    /** **The subject of the Products and Services**

 Patient Resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patient")]
    pub patient: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_ext: Option<FieldExtension>,
    /** **Period for charge submission**

 The billable period for which charges are being submitted.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "billablePeriod")]
    pub billable_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_billablePeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub billable_period_ext: Option<FieldExtension>,
    /** **Creation date**

 The date when the EOB was created.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "created")]
    pub created: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_created")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub created_ext: Option<FieldExtension>,
    /** **Author**

 The person who created the explanation of benefit.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "enterer")]
    pub enterer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_enterer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub enterer_ext: Option<FieldExtension>,
    /** **Insurer responsible for the EOB**

 The insurer which is responsible for the explanation of benefit.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "insurer")]
    pub insurer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_insurer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub insurer_ext: Option<FieldExtension>,
    /** **Responsible provider for the claim**

 The provider which is responsible for the claim.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "provider")]
    pub provider: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_provider")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub provider_ext: Option<FieldExtension>,
    /** **Responsible organization for the claim**

 The provider which is responsible for the claim.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "organization")]
    pub organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_organization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub organization_ext: Option<FieldExtension>,
    /** **Treatment Referral**

 The referral resource which lists the date, practitioner, reason and other supporting information.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "referral")]
    pub referral: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_referral")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub referral_ext: Option<FieldExtension>,
    /** **Servicing Facility**

 Facility where the services were provided.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "facility")]
    pub facility: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_facility")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub facility_ext: Option<FieldExtension>,
    /** **Claim reference**

 The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "claim")]
    pub claim: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_claim")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub claim_ext: Option<FieldExtension>,
    /** **Claim response reference**

 The business identifier for the instance: invoice number, claim number, pre-determination or pre-authorization number.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "claimResponse")]
    pub claim_response: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_claimResponse")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub claim_response_ext: Option<FieldExtension>,
    /** **[RemittanceOutcome](http://hl7.org/fhir/ValueSet/remittance-outcome); complete | error | partial**

 Processing outcome errror, partial or complete processing.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "outcome")]
    pub outcome: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_outcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub outcome_ext: Option<FieldExtension>,
    /** **Disposition Message**

 A description of the status of the adjudication.

 Do we need a disposition code? */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "disposition")]
    pub disposition: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_disposition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub disposition_ext: Option<FieldExtension>,
    /** **Related Claims which may be revelant to processing this claim**

 Other claims which are related to this claim such as prior claim versions or for related services.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "related")]
    pub related: Vec<Option<ExplanationOfBenefitRelated>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_related")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub related_ext: Vec<Option<FieldExtension>>,
    /** **Prescription authorizing services or products**

 Prescription to support the dispensing of Pharmacy or Vision products.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "prescription")]
    pub prescription: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_prescription")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub prescription_ext: Option<FieldExtension>,
    /** **Original prescription if superceded by fulfiller**

 Original prescription which has been superceded by this prescription to support the dispensing of pharmacy services, medications or products. For example, a physician may prescribe a medication which the pharmacy determines is contraindicated, or for which the patient has an intolerance, and therefor issues a new precription for an alternate medication which has the same theraputic intent. The prescription from the pharmacy becomes the 'prescription' and that from the physician becomes the 'original prescription'.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "originalPrescription")]
    pub original_prescription: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_originalPrescription")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub original_prescription_ext: Option<FieldExtension>,
    /** **Party to be paid any benefits payable**

 The party to be reimbursed for the services.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "payee")]
    pub payee: Option<ExplanationOfBenefitPayee>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_payee")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub payee_ext: Option<FieldExtension>,
    /** **Exceptions, special considerations, the condition, situation, prior or concurrent issues**

 Additional information codes regarding exceptions, special considerations, the condition, situation, prior or concurrent issues. Often there are mutiple jurisdiction specific valuesets which are required.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "information")]
    pub information: Vec<Option<ExplanationOfBenefitInformation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_information")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub information_ext: Vec<Option<FieldExtension>>,
    /** **Care Team members**

 The members of the team who provided the overall service as well as their role and whether responsible and qualifications.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "careTeam")]
    pub care_team: Vec<Option<ExplanationOfBenefitCareTeam>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_careTeam")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub care_team_ext: Vec<Option<FieldExtension>>,
    /** **List of Diagnosis**

 Ordered list of patient diagnosis for which care is sought.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "diagnosis")]
    pub diagnosis: Vec<Option<ExplanationOfBenefitDiagnosis>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_diagnosis")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub diagnosis_ext: Vec<Option<FieldExtension>>,
    /** **Procedures performed**

 Ordered list of patient procedures performed to support the adjudication.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "procedure")]
    pub procedure: Vec<Option<ExplanationOfBenefitProcedure>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_procedure")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub procedure_ext: Vec<Option<FieldExtension>>,
    /** **Precedence (primary, secondary, etc.)**

 Precedence (primary, secondary, etc.).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "precedence")]
    pub precedence: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_precedence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub precedence_ext: Option<FieldExtension>,
    /** **Insurance or medical plan**

 Financial instrument by which payment information for health care.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "insurance")]
    pub insurance: Option<ExplanationOfBenefitInsurance>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_insurance")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub insurance_ext: Option<FieldExtension>,
    /** **Details of an accident**

 An accident which resulted in the need for healthcare services.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "accident")]
    pub accident: Option<ExplanationOfBenefitAccident>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_accident")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub accident_ext: Option<FieldExtension>,
    /** **Period unable to work**

 The start and optional end dates of when the patient was precluded from working due to the treatable condition(s).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "employmentImpacted")]
    pub employment_impacted: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_employmentImpacted")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub employment_impacted_ext: Option<FieldExtension>,
    /** **Period in hospital**

 The start and optional end dates of when the patient was confined to a treatment center.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "hospitalization")]
    pub hospitalization: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_hospitalization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub hospitalization_ext: Option<FieldExtension>,
    /** **Goods and Services**

 First tier of goods and services.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "item")]
    pub item: Vec<Option<ExplanationOfBenefitItem>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_item")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub item_ext: Vec<Option<FieldExtension>>,
    /** **Insurer added line items**

 The first tier service adjudications for payor added services.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "addItem")]
    pub add_item: Vec<Option<ExplanationOfBenefitAddItem>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_addItem")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub add_item_ext: Vec<Option<FieldExtension>>,
    /** **Total Cost of service from the Claim**

 The total cost of the services reported.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "totalCost")]
    pub total_cost: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_totalCost")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub total_cost_ext: Option<FieldExtension>,
    /** **Unallocated deductable**

 The amount of deductable applied which was not allocated to any particular service line.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "unallocDeductable")]
    pub unalloc_deductable: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_unallocDeductable")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub unalloc_deductable_ext: Option<FieldExtension>,
    /** **Total benefit payable for the Claim**

 Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductable).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "totalBenefit")]
    pub total_benefit: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_totalBenefit")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub total_benefit_ext: Option<FieldExtension>,
    /** **Payment (if paid)**

 Payment details for the claim if the claim has been paid.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "payment")]
    pub payment: Option<ExplanationOfBenefitPayment>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_payment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub payment_ext: Option<FieldExtension>,
    /** **[Forms](http://hl7.org/fhir/ValueSet/forms); Printed Form Identifier**

 The form to be used for printing the content.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "form")]
    pub form: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_form")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub form_ext: Option<FieldExtension>,
    /** **Processing notes**

 Note text.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "processNote")]
    pub process_note: Vec<Option<ExplanationOfBenefitProcessNote>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_processNote")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub process_note_ext: Vec<Option<FieldExtension>>,
    /** **Balance by Benefit Category**

 Balance by Benefit Category.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "benefitBalance")]
    pub benefit_balance: Vec<Option<ExplanationOfBenefitBenefitBalance>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_benefitBalance")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub benefit_balance_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitBuilder {
    #[doc = concat!("Finalize building ", "ExplanationOfBenefit", ".")]
    pub fn build(self) -> Result<ExplanationOfBenefit, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ExplanationOfBenefitInner> for ExplanationOfBenefit {
    fn from(inner: ExplanationOfBenefitInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ExplanationOfBenefit {
    type Target = ExplanationOfBenefitInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ExplanationOfBenefit {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ExplanationOfBenefit {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitBuilder {
        ExplanationOfBenefitBuilder::default()
    }
}
impl ExplanationOfBenefit {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ExplanationOfBenefit
    }
}
/// Sub-fields of the related field in ExplanationOfBenefit
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExplanationOfBenefitRelatedBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitRelated {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Reference to the related claim**

 Other claims which are related to this claim such as prior claim versions or for related services.

 Do we need a relationship code? */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "claim")]
    pub claim: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_claim")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub claim_ext: Option<FieldExtension>,
    /** **[RelatedClaimRelationship](http://hl7.org/fhir/ValueSet/related-claim-relationship); How the reference claim is related**

 For example prior or umbrella.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relationship")]
    pub relationship: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_relationship")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub relationship_ext: Option<FieldExtension>,
    /** **Related file or case reference**

 An alternate organizational reference to the case or file to which this particular claim pertains - eg Property/Casualy insurer claim # or Workers Compensation case # .

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reference")]
    pub reference: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reference_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitRelated {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitRelatedBuilder {
        ExplanationOfBenefitRelatedBuilder::default()
    }
}
/// Sub-fields of the payee field in ExplanationOfBenefit
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExplanationOfBenefitPayeeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitPayee {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[PayeeType](http://hl7.org/fhir/ValueSet/payeetype); Type of party: Subscriber, Provider, other**

 Type of Party to be reimbursed: Subscriber, provider, other.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[PayeeResourceType](http://hl7.org/fhir/ValueSet/resource-type-link); organization | patient | practitioner | relatedperson**

 organization | patient | practitioner | relatedperson.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "resourceType")]
    pub resource_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_resourceType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub resource_type_ext: Option<FieldExtension>,
    /** **Party to receive the payable**

 Party to be reimbursed: Subscriber, provider, other.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "party")]
    pub party: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_party")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub party_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitPayee {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitPayeeBuilder {
        ExplanationOfBenefitPayeeBuilder::default()
    }
}
/// Sub-fields of the information field in ExplanationOfBenefit
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExplanationOfBenefitInformationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitInformation {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Information instance identifier**

 Sequence of the information element which serves to provide a link.

 */
    #[serde(rename = "sequence")]
    pub sequence: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_ext: Option<FieldExtension>,
    /** **[InformationCategory](http://hl7.org/fhir/ValueSet/claim-informationcategory); General class of information**

 The general class of the information supplied: information; exception; accident, employment; onset, etc.

 This may contain the local bill type codes such as the US UB-04 bill type code. */
    #[serde(rename = "category")]
    pub category: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[InformationCode](http://hl7.org/fhir/ValueSet/claim-exception); Type of information**

 System and code pertaining to the specific information regarding special conditions relating to the setting, treatment or patient  for which care is sought which may influence the adjudication.

 This may contain the local bill type codes such as the US UB-04 bill type code. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **When it occurred**

 The date when or period to which this information refers.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub timing: Option<ExplanationOfBenefitInformationTiming>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub timing_ext: Option<ExplanationOfBenefitInformationTimingExtension>,
    /** **Additional Data or supporting information**

 Additional data or information such as resources, documents, images etc. including references to the data or the actual inclusion of the data.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<ExplanationOfBenefitInformationValue>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<ExplanationOfBenefitInformationValueExtension>,
    /** **[MissingReason](http://hl7.org/fhir/ValueSet/missing-tooth-reason); Reason associated with the information**

 For example, provides the reason for: the additional stay, or missing tooth or any other situation where a reason code is required in addition to the content.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reason_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitInformation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitInformationBuilder {
        ExplanationOfBenefitInformationBuilder::default()
    }
}
/// Choice of types for the timing[x] field in ExplanationOfBenefitInformation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitInformationTiming {
    /// Variant accepting the Date type.
    #[serde(rename = "timingDate")]
    Date(Date),
    /// Variant accepting the Period type.
    #[serde(rename = "timingPeriod")]
    Period(Period),
}
/// Extension value for ExplanationOfBenefitInformationTiming.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitInformationTimingExtension {
    /// Variant accepting the Date extension.
    #[serde(rename = "_timingDate")]
    Date(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_timingPeriod")]
    Period(FieldExtension),
}
/// Choice of types for the value[x] field in ExplanationOfBenefitInformation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitInformationValue {
    /// Variant accepting the String type.
    #[serde(rename = "valueString")]
    String(String),
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Attachment type.
    #[serde(rename = "valueAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Reference type.
    #[serde(rename = "valueReference")]
    Reference(Reference),
}
/// Extension value for ExplanationOfBenefitInformationValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitInformationValueExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_valueString")]
    String(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_valueAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_valueReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the careTeam field in ExplanationOfBenefit
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExplanationOfBenefitCareTeamBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitCareTeam {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Number to covey order of careteam**

 Sequence of careteam which serves to order and provide a link.

 */
    #[serde(rename = "sequence")]
    pub sequence: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_ext: Option<FieldExtension>,
    /** **Member of the Care Team**

 The members of the team who provided the overall service.

 */
    #[serde(rename = "provider")]
    pub provider: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_provider")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub provider_ext: Option<FieldExtension>,
    /** **Billing practitioner**

 The practitioner who is billing and responsible for the claimed services rendered to the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "responsible")]
    pub responsible: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_responsible")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub responsible_ext: Option<FieldExtension>,
    /** **[CareTeamRole](http://hl7.org/fhir/ValueSet/claim-careteamrole); Role on the team**

 The lead, assisting or supervising practitioner and their discipline if a multidisiplinary team.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "role")]
    pub role: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_role")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub role_ext: Option<FieldExtension>,
    /** **[ProviderQualification](http://hl7.org/fhir/ValueSet/provider-qualification); Type, classification or Specialization**

 The qualification which is applicable for this service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "qualification")]
    pub qualification: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_qualification")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub qualification_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitCareTeam {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitCareTeamBuilder {
        ExplanationOfBenefitCareTeamBuilder::default()
    }
}
/// Sub-fields of the diagnosis field in ExplanationOfBenefit
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExplanationOfBenefitDiagnosisBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitDiagnosis {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Number to covey order of diagnosis**

 Sequence of diagnosis which serves to provide a link.

 */
    #[serde(rename = "sequence")]
    pub sequence: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_ext: Option<FieldExtension>,
    /** **Patient's diagnosis**

 The diagnosis.

 */
    #[serde(flatten)]
    pub diagnosis: ExplanationOfBenefitDiagnosisDiagnosis,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub diagnosis_ext: Option<ExplanationOfBenefitDiagnosisDiagnosisExtension>,
    /** **[DiagnosisType](http://hl7.org/fhir/ValueSet/ex-diagnosistype); Timing or nature of the diagnosis**

 The type of the Diagnosis, for example: admitting, primary, secondary, discharge.

 Diagnosis are presented in list order to their expected importance: primary, secondary, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub r#type_ext: Vec<Option<FieldExtension>>,
    /** **[DiagnosisRelatedGroup](http://hl7.org/fhir/ValueSet/ex-diagnosisrelatedgroup); Package billing code**

 The package billing code, for example DRG, based on the assigned grouping code system.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "packageCode")]
    pub package_code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_packageCode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub package_code_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitDiagnosis {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitDiagnosisBuilder {
        ExplanationOfBenefitDiagnosisBuilder::default()
    }
}
/// Choice of types for the diagnosis[x] field in ExplanationOfBenefitDiagnosis
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitDiagnosisDiagnosis {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "diagnosisCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "diagnosisReference")]
    Reference(Reference),
}
/// Extension value for ExplanationOfBenefitDiagnosisDiagnosis.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitDiagnosisDiagnosisExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_diagnosisCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_diagnosisReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the procedure field in ExplanationOfBenefit
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExplanationOfBenefitProcedureBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitProcedure {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Procedure sequence for reference**

 Sequence of procedures which serves to order and provide a link.

 */
    #[serde(rename = "sequence")]
    pub sequence: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_ext: Option<FieldExtension>,
    /** **When the procedure was performed**

 Date and optionally time the procedure was performed .

 SB DateTime?? */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Patient's list of procedures performed**

 The procedure code.

 */
    #[serde(flatten)]
    pub procedure: ExplanationOfBenefitProcedureProcedure,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub procedure_ext: Option<ExplanationOfBenefitProcedureProcedureExtension>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitProcedure {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitProcedureBuilder {
        ExplanationOfBenefitProcedureBuilder::default()
    }
}
/// Choice of types for the procedure[x] field in ExplanationOfBenefitProcedure
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitProcedureProcedure {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "procedureCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "procedureReference")]
    Reference(Reference),
}
/// Extension value for ExplanationOfBenefitProcedureProcedure.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitProcedureProcedureExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_procedureCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_procedureReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the insurance field in ExplanationOfBenefit
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExplanationOfBenefitInsuranceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitInsurance {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Insurance information**

 Reference to the program or plan identification, underwriter or payor.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "coverage")]
    pub coverage: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_coverage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub coverage_ext: Option<FieldExtension>,
    /** **Pre-Authorization/Determination Reference**

 A list of references from the Insurer to which these services pertain.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "preAuthRef")]
    pub pre_auth_ref: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_preAuthRef")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub pre_auth_ref_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitInsurance {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitInsuranceBuilder {
        ExplanationOfBenefitInsuranceBuilder::default()
    }
}
/// Sub-fields of the accident field in ExplanationOfBenefit
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExplanationOfBenefitAccidentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitAccident {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **When the accident occurred**

 Date of an accident which these services are addressing.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **[AccidentType](http://hl7.org/fhir/ValueSet/v3-ActIncidentCode); The nature of the accident**

 Type of accident: work, auto, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Accident Place**

 Where the accident occurred.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub location: Option<ExplanationOfBenefitAccidentLocation>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub location_ext: Option<ExplanationOfBenefitAccidentLocationExtension>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitAccident {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitAccidentBuilder {
        ExplanationOfBenefitAccidentBuilder::default()
    }
}
/// Choice of types for the location[x] field in ExplanationOfBenefitAccident
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitAccidentLocation {
    /// Variant accepting the Address type.
    #[serde(rename = "locationAddress")]
    Address(Address),
    /// Variant accepting the Reference type.
    #[serde(rename = "locationReference")]
    Reference(Reference),
}
/// Extension value for ExplanationOfBenefitAccidentLocation.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitAccidentLocationExtension {
    /// Variant accepting the Address extension.
    #[serde(rename = "_locationAddress")]
    Address(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_locationReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the item field in ExplanationOfBenefit
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExplanationOfBenefitItemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitItem {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Service instance**

 A service line number.

 */
    #[serde(rename = "sequence")]
    pub sequence: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_ext: Option<FieldExtension>,
    /** **Applicable careteam members**

 Careteam applicable for this service or product line.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "careTeamLinkId")]
    pub care_team_link_id: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_careTeamLinkId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub care_team_link_id_ext: Vec<Option<FieldExtension>>,
    /** **Applicable diagnoses**

 Diagnosis applicable for this service or product line.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "diagnosisLinkId")]
    pub diagnosis_link_id: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_diagnosisLinkId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub diagnosis_link_id_ext: Vec<Option<FieldExtension>>,
    /** **Applicable procedures**

 Procedures applicable for this service or product line.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "procedureLinkId")]
    pub procedure_link_id: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_procedureLinkId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub procedure_link_id_ext: Vec<Option<FieldExtension>>,
    /** **Applicable exception and supporting information**

 Exceptions, special conditions and supporting information pplicable for this service or product line.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "informationLinkId")]
    pub information_link_id: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_informationLinkId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub information_link_id_ext: Vec<Option<FieldExtension>>,
    /** **[RevenueCenter](http://hl7.org/fhir/ValueSet/ex-revenue-center); Revenue or cost center code**

 The type of reveneu or cost center providing the product and/or service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "revenue")]
    pub revenue: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_revenue")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub revenue_ext: Option<FieldExtension>,
    /** **[BenefitSubCategory](http://hl7.org/fhir/ValueSet/benefit-subcategory); Type of service or product**

 Health Care Service Type Codes  to identify the classification of service or benefits.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); Billing Code**

 If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "service")]
    pub service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_service")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub service_ext: Option<FieldExtension>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Service/Product billing modifiers**

 Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifier")]
    pub modifier: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_modifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub modifier_ext: Vec<Option<FieldExtension>>,
    /** **[ProgramCode](http://hl7.org/fhir/ValueSet/ex-program-code); Program specific reason for item inclusion**

 For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "programCode")]
    pub program_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_programCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub program_code_ext: Vec<Option<FieldExtension>>,
    /** **Date or dates of Service**

 The date or dates when the enclosed suite of services were performed or completed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub serviced: Option<ExplanationOfBenefitItemServiced>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub serviced_ext: Option<ExplanationOfBenefitItemServicedExtension>,
    /** **Place of service**

 Where the service was provided.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub location: Option<ExplanationOfBenefitItemLocation>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub location_ext: Option<ExplanationOfBenefitItemLocationExtension>,
    /** **Count of Products or Services**

 The number of repetitions of a service or product.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_quantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<FieldExtension>,
    /** **Fee, charge or cost per point**

 If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "unitPrice")]
    pub unit_price: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_unitPrice")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub unit_price_ext: Option<FieldExtension>,
    /** **Price scaling factor**

 A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "factor")]
    pub factor: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_factor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub factor_ext: Option<FieldExtension>,
    /** **Total item cost**

 The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "net")]
    pub net: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_net")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub net_ext: Option<FieldExtension>,
    /** **Unique Device Identifier**

 List of Unique Device Identifiers associated with this line item.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "udi")]
    pub udi: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_udi")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub udi_ext: Vec<Option<FieldExtension>>,
    /** **[OralSites](http://hl7.org/fhir/ValueSet/tooth); Service Location**

 Physical service site on the patient (limb, tooth, etc).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "bodySite")]
    pub body_site: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_bodySite")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub body_site_ext: Option<FieldExtension>,
    /** **[Surface](http://hl7.org/fhir/ValueSet/surface); Service Sub-location**

 A region or surface of the site, eg. limb region or tooth surface(s).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subSite")]
    pub sub_site: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subSite")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub sub_site_ext: Vec<Option<FieldExtension>>,
    /** **Encounters related to this billed item**

 A billed item may include goods or services provided in multiple encounters.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "encounter")]
    pub encounter: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_encounter")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub encounter_ext: Vec<Option<FieldExtension>>,
    /** **List of note numbers which apply**

 A list of note references to the notes provided below.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "noteNumber")]
    pub note_number: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_noteNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_number_ext: Vec<Option<FieldExtension>>,
    /** **Adjudication details**

 The adjudications results.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "adjudication")]
    pub adjudication: Vec<Option<ExplanationOfBenefitItemAdjudication>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_adjudication")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub adjudication_ext: Vec<Option<FieldExtension>>,
    /** **Additional items**

 Second tier of goods and services.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "detail")]
    pub detail: Vec<Option<ExplanationOfBenefitItemDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_detail")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub detail_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitItem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitItemBuilder {
        ExplanationOfBenefitItemBuilder::default()
    }
}
/// Choice of types for the serviced[x] field in ExplanationOfBenefitItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitItemServiced {
    /// Variant accepting the Date type.
    #[serde(rename = "servicedDate")]
    Date(Date),
    /// Variant accepting the Period type.
    #[serde(rename = "servicedPeriod")]
    Period(Period),
}
/// Extension value for ExplanationOfBenefitItemServiced.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitItemServicedExtension {
    /// Variant accepting the Date extension.
    #[serde(rename = "_servicedDate")]
    Date(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_servicedPeriod")]
    Period(FieldExtension),
}
/// Choice of types for the location[x] field in ExplanationOfBenefitItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitItemLocation {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "locationCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Address type.
    #[serde(rename = "locationAddress")]
    Address(Address),
    /// Variant accepting the Reference type.
    #[serde(rename = "locationReference")]
    Reference(Reference),
}
/// Extension value for ExplanationOfBenefitItemLocation.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitItemLocationExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_locationCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Address extension.
    #[serde(rename = "_locationAddress")]
    Address(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_locationReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the adjudication field in ExplanationOfBenefitItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExplanationOfBenefitItemAdjudicationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitItemAdjudication {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[Adjudication](http://hl7.org/fhir/ValueSet/adjudication); Adjudication category such as co-pay, eligible, benefit, etc.**

 Code indicating: Co-Pay, deductable, elegible, benefit, tax, etc.

 */
    #[serde(rename = "category")]
    pub category: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[AdjudicationReason](http://hl7.org/fhir/ValueSet/adjudication-reason); Explanation of Adjudication outcome**

 Adjudication reason such as limit reached.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reason_ext: Option<FieldExtension>,
    /** **Monetary amount**

 Monitory amount associated with the code.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "amount")]
    pub amount: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_amount")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub amount_ext: Option<FieldExtension>,
    /** **Non-monitory value**

 A non-monetary value for example a percentage. Mutually exclusive to the amount element above.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "value")]
    pub value: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_value")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitItemAdjudication {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitItemAdjudicationBuilder {
        ExplanationOfBenefitItemAdjudicationBuilder::default()
    }
}
/// Sub-fields of the detail field in ExplanationOfBenefitItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExplanationOfBenefitItemDetailBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitItemDetail {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Service instance**

 A service line number.

 */
    #[serde(rename = "sequence")]
    pub sequence: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_ext: Option<FieldExtension>,
    /** **[ItemType](http://hl7.org/fhir/ValueSet/v3-ActInvoiceGroupCode); Group or type of product or service**

 The type of product or service.

 ItemType. */
    #[serde(rename = "type")]
    pub r#type: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[RevenueCenter](http://hl7.org/fhir/ValueSet/ex-revenue-center); Revenue or cost center code**

 The type of reveneu or cost center providing the product and/or service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "revenue")]
    pub revenue: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_revenue")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub revenue_ext: Option<FieldExtension>,
    /** **[BenefitSubCategory](http://hl7.org/fhir/ValueSet/benefit-subcategory); Type of service or product**

 Health Care Service Type Codes  to identify the classification of service or benefits.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); Billing Code**

 If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "service")]
    pub service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_service")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub service_ext: Option<FieldExtension>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Service/Product billing modifiers**

 Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifier")]
    pub modifier: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_modifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub modifier_ext: Vec<Option<FieldExtension>>,
    /** **[ProgramCode](http://hl7.org/fhir/ValueSet/ex-program-code); Program specific reason for item inclusion**

 For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "programCode")]
    pub program_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_programCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub program_code_ext: Vec<Option<FieldExtension>>,
    /** **Count of Products or Services**

 The number of repetitions of a service or product.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_quantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<FieldExtension>,
    /** **Fee, charge or cost per point**

 If the item is a node then this is the fee for the product or service, otherwise this is the total of the fees for the children of the group.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "unitPrice")]
    pub unit_price: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_unitPrice")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub unit_price_ext: Option<FieldExtension>,
    /** **Price scaling factor**

 A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "factor")]
    pub factor: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_factor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub factor_ext: Option<FieldExtension>,
    /** **Total additional item cost**

 The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "net")]
    pub net: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_net")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub net_ext: Option<FieldExtension>,
    /** **Unique Device Identifier**

 List of Unique Device Identifiers associated with this line item.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "udi")]
    pub udi: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_udi")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub udi_ext: Vec<Option<FieldExtension>>,
    /** **List of note numbers which apply**

 A list of note references to the notes provided below.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "noteNumber")]
    pub note_number: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_noteNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_number_ext: Vec<Option<FieldExtension>>,
    /** **Detail level adjudication details**

 The adjudications results.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "adjudication")]
    pub adjudication: Vec<Option<ExplanationOfBenefitItemAdjudication>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_adjudication")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub adjudication_ext: Vec<Option<FieldExtension>>,
    /** **Additional items**

 Third tier of goods and services.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subDetail")]
    pub sub_detail: Vec<Option<ExplanationOfBenefitItemDetailSubDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subDetail")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub sub_detail_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitItemDetail {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitItemDetailBuilder {
        ExplanationOfBenefitItemDetailBuilder::default()
    }
}
/// Sub-fields of the subDetail field in ExplanationOfBenefitItemDetail
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExplanationOfBenefitItemDetailSubDetailBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitItemDetailSubDetail {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Service instance**

 A service line number.

 */
    #[serde(rename = "sequence")]
    pub sequence: NonZeroU32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_ext: Option<FieldExtension>,
    /** **[ItemType](http://hl7.org/fhir/ValueSet/v3-ActInvoiceGroupCode); Type of product or service**

 The type of product or service.

 */
    #[serde(rename = "type")]
    pub r#type: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[RevenueCenter](http://hl7.org/fhir/ValueSet/ex-revenue-center); Revenue or cost center code**

 The type of reveneu or cost center providing the product and/or service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "revenue")]
    pub revenue: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_revenue")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub revenue_ext: Option<FieldExtension>,
    /** **[BenefitSubCategory](http://hl7.org/fhir/ValueSet/benefit-subcategory); Type of service or product**

 Health Care Service Type Codes  to identify the classification of service or benefits.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); Billing Code**

 A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "service")]
    pub service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_service")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub service_ext: Option<FieldExtension>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Service/Product billing modifiers**

 Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifier")]
    pub modifier: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_modifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub modifier_ext: Vec<Option<FieldExtension>>,
    /** **[ProgramCode](http://hl7.org/fhir/ValueSet/ex-program-code); Program specific reason for item inclusion**

 For programs which require reson codes for the inclusion, covering, of this billed item under the program or sub-program.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "programCode")]
    pub program_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_programCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub program_code_ext: Vec<Option<FieldExtension>>,
    /** **Count of Products or Services**

 The number of repetitions of a service or product.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_quantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<FieldExtension>,
    /** **Fee, charge or cost per point**

 The fee for an addittional service or product or charge.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "unitPrice")]
    pub unit_price: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_unitPrice")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub unit_price_ext: Option<FieldExtension>,
    /** **Price scaling factor**

 A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "factor")]
    pub factor: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_factor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub factor_ext: Option<FieldExtension>,
    /** **Net additional item cost**

 The quantity times the unit price for an addittional service or product or charge. For example, the formula: unit Quantity * unit Price (Cost per Point) * factor Number  * points = net Amount. Quantity, factor and points are assumed to be 1 if not supplied.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "net")]
    pub net: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_net")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub net_ext: Option<FieldExtension>,
    /** **Unique Device Identifier**

 List of Unique Device Identifiers associated with this line item.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "udi")]
    pub udi: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_udi")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub udi_ext: Vec<Option<FieldExtension>>,
    /** **List of note numbers which apply**

 A list of note references to the notes provided below.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "noteNumber")]
    pub note_number: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_noteNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_number_ext: Vec<Option<FieldExtension>>,
    /** **Language if different from the resource**

 The adjudications results.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "adjudication")]
    pub adjudication: Vec<Option<ExplanationOfBenefitItemAdjudication>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_adjudication")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub adjudication_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitItemDetailSubDetail {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitItemDetailSubDetailBuilder {
        ExplanationOfBenefitItemDetailSubDetailBuilder::default()
    }
}
/// Sub-fields of the addItem field in ExplanationOfBenefit
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExplanationOfBenefitAddItemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitAddItem {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Service instances**

 List of input service items which this service line is intended to replace.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sequenceLinkId")]
    pub sequence_link_id: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_sequenceLinkId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub sequence_link_id_ext: Vec<Option<FieldExtension>>,
    /** **[RevenueCenter](http://hl7.org/fhir/ValueSet/ex-revenue-center); Revenue or cost center code**

 The type of reveneu or cost center providing the product and/or service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "revenue")]
    pub revenue: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_revenue")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub revenue_ext: Option<FieldExtension>,
    /** **[BenefitSubCategory](http://hl7.org/fhir/ValueSet/benefit-subcategory); Type of service or product**

 Health Care Service Type Codes  to identify the classification of service or benefits.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); Billing Code**

 If this is an actual service or product line, ie. not a Group, then use code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI). If a grouping item then use a group code to indicate the type of thing being grouped eg. 'glasses' or 'compound'.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "service")]
    pub service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_service")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub service_ext: Option<FieldExtension>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Service/Product billing modifiers**

 Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifier")]
    pub modifier: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_modifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub modifier_ext: Vec<Option<FieldExtension>>,
    /** **Professional fee or Product charge**

 The fee charged for the professional service or product.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "fee")]
    pub fee: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_fee")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub fee_ext: Option<FieldExtension>,
    /** **List of note numbers which apply**

 A list of note references to the notes provided below.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "noteNumber")]
    pub note_number: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_noteNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_number_ext: Vec<Option<FieldExtension>>,
    /** **Added items adjudication**

 The adjudications results.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "adjudication")]
    pub adjudication: Vec<Option<ExplanationOfBenefitItemAdjudication>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_adjudication")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub adjudication_ext: Vec<Option<FieldExtension>>,
    /** **Added items details**

 The second tier service adjudications for payor added services.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "detail")]
    pub detail: Vec<Option<ExplanationOfBenefitAddItemDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_detail")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub detail_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitAddItem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitAddItemBuilder {
        ExplanationOfBenefitAddItemBuilder::default()
    }
}
/// Sub-fields of the detail field in ExplanationOfBenefitAddItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExplanationOfBenefitAddItemDetailBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitAddItemDetail {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[RevenueCenter](http://hl7.org/fhir/ValueSet/ex-revenue-center); Revenue or cost center code**

 The type of reveneu or cost center providing the product and/or service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "revenue")]
    pub revenue: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_revenue")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub revenue_ext: Option<FieldExtension>,
    /** **[BenefitSubCategory](http://hl7.org/fhir/ValueSet/benefit-subcategory); Type of service or product**

 Health Care Service Type Codes  to identify the classification of service or benefits.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[ServiceProduct](http://hl7.org/fhir/ValueSet/service-uscls); Billing Code**

 A code to indicate the Professional Service or Product supplied (eg. CTP, HCPCS,USCLS,ICD10, NCPDP,DIN,ACHI,CCI).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "service")]
    pub service: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_service")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub service_ext: Option<FieldExtension>,
    /** **[Modifiers](http://hl7.org/fhir/ValueSet/claim-modifiers); Service/Product billing modifiers**

 Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifier")]
    pub modifier: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_modifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub modifier_ext: Vec<Option<FieldExtension>>,
    /** **Professional fee or Product charge**

 The fee charged for the professional service or product.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "fee")]
    pub fee: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_fee")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub fee_ext: Option<FieldExtension>,
    /** **List of note numbers which apply**

 A list of note references to the notes provided below.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "noteNumber")]
    pub note_number: Vec<Option<NonZeroU32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_noteNumber")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_number_ext: Vec<Option<FieldExtension>>,
    /** **Added items detail adjudication**

 The adjudications results.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "adjudication")]
    pub adjudication: Vec<Option<ExplanationOfBenefitItemAdjudication>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_adjudication")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub adjudication_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitAddItemDetail {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitAddItemDetailBuilder {
        ExplanationOfBenefitAddItemDetailBuilder::default()
    }
}
/// Sub-fields of the payment field in ExplanationOfBenefit
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExplanationOfBenefitPaymentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitPayment {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[PaymentType](http://hl7.org/fhir/ValueSet/ex-paymenttype); Partial or Complete**

 Whether this represents partial or complete payment of the claim.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Payment adjustment for non-Claim issues**

 Adjustment to the payment of this transaction which is not related to adjudication of this transaction.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "adjustment")]
    pub adjustment: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_adjustment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub adjustment_ext: Option<FieldExtension>,
    /** **[PaymentAdjustmentReason](http://hl7.org/fhir/ValueSet/payment-adjustment-reason); Explanation for the non-claim adjustment**

 Reason for the payment adjustment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "adjustmentReason")]
    pub adjustment_reason: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_adjustmentReason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub adjustment_reason_ext: Option<FieldExtension>,
    /** **Expected date of Payment**

 Estimated payment date.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Payable amount after adjustment**

 Payable less any payment adjustment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "amount")]
    pub amount: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_amount")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub amount_ext: Option<FieldExtension>,
    /** **Identifier of the payment instrument**

 Payment identifer.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitPayment {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitPaymentBuilder {
        ExplanationOfBenefitPaymentBuilder::default()
    }
}
/// Sub-fields of the processNote field in ExplanationOfBenefit
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExplanationOfBenefitProcessNoteBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitProcessNote {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Sequence number for this note**

 An integer associated with each note which may be referred to from each service line item.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "number")]
    pub number: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_number")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub number_ext: Option<FieldExtension>,
    /** **[NoteType](http://hl7.org/fhir/ValueSet/note-type); display | print | printoper**

 The note purpose: Print/Display.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Note explanitory text**

 The note text.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_text")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub text_ext: Option<FieldExtension>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language if different from the resource**

 The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. "en" for English, or "en-US" for American English versus "en-EN" for England English.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_language")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub language_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitProcessNote {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitProcessNoteBuilder {
        ExplanationOfBenefitProcessNoteBuilder::default()
    }
}
/// Sub-fields of the benefitBalance field in ExplanationOfBenefit
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExplanationOfBenefitBenefitBalanceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitBenefitBalance {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[BenefitCategory](http://hl7.org/fhir/ValueSet/benefit-category); Type of services covered**

 Dental, Vision, Medical, Pharmacy, Rehab etc.

 */
    #[serde(rename = "category")]
    pub category: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[BenefitSubCategory](http://hl7.org/fhir/ValueSet/benefit-subcategory); Detailed services covered within the type**

 Dental: basic, major, ortho; Vision exam, glasses, contacts; etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subCategory")]
    pub sub_category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subCategory")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sub_category_ext: Option<FieldExtension>,
    /** **Excluded from the plan**

 True if the indicated class of service is excluded from the plan, missing or False indicated the service is included in the coverage.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "excluded")]
    pub excluded: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_excluded")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub excluded_ext: Option<FieldExtension>,
    /** **Short name for the benefit**

 A short name or tag for the benefit, for example MED01, or DENT2.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Description of the benefit or services covered**

 A richer description of the benefit, for example 'DENT2 covers 100% of basic, 50% of major but exclused Ortho, Implants and Costmetic services'.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **[BenefitNetwork](http://hl7.org/fhir/ValueSet/benefit-network); In or out of network**

 Network designation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "network")]
    pub network: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_network")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub network_ext: Option<FieldExtension>,
    /** **[BenefitUnit](http://hl7.org/fhir/ValueSet/benefit-unit); Individual or family**

 Unit designation: individual or family.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "unit")]
    pub unit: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_unit")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub unit_ext: Option<FieldExtension>,
    /** **[BenefitTerm](http://hl7.org/fhir/ValueSet/benefit-term); Annual or lifetime**

 The term or period of the values such as 'maximum lifetime benefit' or 'maximum annual vistis'.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "term")]
    pub term: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_term")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub term_ext: Option<FieldExtension>,
    /** **Benefit Summary**

 Benefits Used to date.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "financial")]
    pub financial: Vec<Option<ExplanationOfBenefitBenefitBalanceFinancial>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_financial")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub financial_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitBenefitBalance {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitBenefitBalanceBuilder {
        ExplanationOfBenefitBenefitBalanceBuilder::default()
    }
}
/// Sub-fields of the financial field in ExplanationOfBenefitBenefitBalance
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ExplanationOfBenefitBenefitBalanceFinancialBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ExplanationOfBenefitBenefitBalanceFinancial {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[BenefitType](http://hl7.org/fhir/ValueSet/benefit-type); Deductable, visits, benefit amount**

 Deductable, visits, benefit amount.

 */
    #[serde(rename = "type")]
    pub r#type: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Benefits allowed**

 Benefits allowed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub allowed: Option<ExplanationOfBenefitBenefitBalanceFinancialAllowed>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub allowed_ext: Option<ExplanationOfBenefitBenefitBalanceFinancialAllowedExtension>,
    /** **Benefits used**

 Benefits used.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub used: Option<ExplanationOfBenefitBenefitBalanceFinancialUsed>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub used_ext: Option<ExplanationOfBenefitBenefitBalanceFinancialUsedExtension>,
}
#[cfg(feature = "builders")]
impl ExplanationOfBenefitBenefitBalanceFinancial {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ExplanationOfBenefitBenefitBalanceFinancialBuilder {
        ExplanationOfBenefitBenefitBalanceFinancialBuilder::default()
    }
}
/// Choice of types for the allowed[x] field in ExplanationOfBenefitBenefitBalanceFinancial
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitBenefitBalanceFinancialAllowed {
    /// Variant accepting the UnsignedInt type.
    #[serde(rename = "allowedUnsignedInt")]
    UnsignedInt(u32),
    /// Variant accepting the String type.
    #[serde(rename = "allowedString")]
    String(String),
    /// Variant accepting the Money type.
    #[serde(rename = "allowedMoney")]
    Money(Money),
}
/// Extension value for ExplanationOfBenefitBenefitBalanceFinancialAllowed.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitBenefitBalanceFinancialAllowedExtension {
    /// Variant accepting the UnsignedInt extension.
    #[serde(rename = "_allowedUnsignedInt")]
    UnsignedInt(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_allowedString")]
    String(FieldExtension),
    /// Variant accepting the Money extension.
    #[serde(rename = "_allowedMoney")]
    Money(FieldExtension),
}
/// Choice of types for the used[x] field in ExplanationOfBenefitBenefitBalanceFinancial
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitBenefitBalanceFinancialUsed {
    /// Variant accepting the UnsignedInt type.
    #[serde(rename = "usedUnsignedInt")]
    UnsignedInt(u32),
    /// Variant accepting the Money type.
    #[serde(rename = "usedMoney")]
    Money(Money),
}
/// Extension value for ExplanationOfBenefitBenefitBalanceFinancialUsed.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ExplanationOfBenefitBenefitBalanceFinancialUsedExtension {
    /// Variant accepting the UnsignedInt extension.
    #[serde(rename = "_usedUnsignedInt")]
    UnsignedInt(FieldExtension),
    /// Variant accepting the Money extension.
    #[serde(rename = "_usedMoney")]
    Money(FieldExtension),
}
/** Base StructureDefinition for FamilyMemberHistory Resource

 **[FamilyMemberHistory](http://hl7.org/fhir/StructureDefinition/FamilyMemberHistory) v3.0.2**

 Information about patient's relatives, relevant for patient

 Significant health events and conditions for a person related to the patient relevant in the context of care for the patient.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct FamilyMemberHistory(pub Box<FamilyMemberHistoryInner>);
/** Base StructureDefinition for FamilyMemberHistory Resource

 **[FamilyMemberHistory](http://hl7.org/fhir/StructureDefinition/FamilyMemberHistory) v3.0.2**

 Information about patient's relatives, relevant for patient

 Significant health events and conditions for a person related to the patient relevant in the context of care for the patient.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "FamilyMemberHistoryBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct FamilyMemberHistoryInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "FamilyMemberHistory::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::FamilyMemberHistory", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **External Id(s) for this record**

 This records identifiers associated with this family member history record that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Instantiates protocol or definition**

 A protocol or questionnaire that was adhered to in whole or in part by this event.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definition")]
    pub definition: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_definition")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub definition_ext: Vec<Option<FieldExtension>>,
    /** **[FamilyHistoryStatus](http://hl7.org/fhir/ValueSet/history-status); partial | completed | entered-in-error | health-unknown**

 A code specifying the status of the record of the family history of a specific family member.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::FamilyHistoryStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **The taking of a family member's history did not occur**

 If true, indicates the taking of an individual family member's history did not occur. The notDone element should not be used to document negated conditions, such as a family member that did not have a condition.

 This element is labeled as a modifier because it marks the family member history as a family member history that did not occur.  The more attributes are populated, the more constrained the negated statement is.  This notDone element is being evaluated and will likely be removed in a subsequent release. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "notDone")]
    pub not_done: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_notDone")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub not_done_ext: Option<FieldExtension>,
    /** **[FamilyHistoryNotDoneReason](http://hl7.org/fhir/ValueSet/history-not-done-reason); subject-unknown | withheld | unable-to-obtain | deferred**

 Describes why the family member's history is absent.

 This notDoneReason element is being evaluated and will likely be replaced in a subsequent release (e.g. dataAbsentReason). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "notDoneReason")]
    pub not_done_reason: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_notDoneReason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub not_done_reason_ext: Option<FieldExtension>,
    /** **Patient history is about**

 The person who this history concerns.

 */
    #[serde(rename = "patient")]
    pub patient: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_ext: Option<FieldExtension>,
    /** **When history was captured/updated**

 The date (and possibly time) when the family member history was taken.

 This should be captured even if the same as the date on the List aggregating the full family history. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **The family member described**

 This will either be a name or a description; e.g. "Aunt Susan", "my cousin with the red hair".

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **[FamilialRelationship](http://hl7.org/fhir/ValueSet/v3-FamilyMember); Relationship to the subject**

 The type of relationship this person has to the patient (father, mother, brother etc.).

 */
    #[serde(rename = "relationship")]
    pub relationship: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_relationship")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub relationship_ext: Option<FieldExtension>,
    /** **[AdministrativeGender](http://hl7.org/fhir/ValueSet/administrative-gender); male | female | other | unknown**

 Administrative Gender - the gender that the relative is considered to have for administration and record keeping purposes.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "gender")]
    pub gender: Option<codes::AdministrativeGender>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_gender")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub gender_ext: Option<FieldExtension>,
    /** **(approximate) date of birth**

 The actual or approximate date of birth of the relative.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub born: Option<FamilyMemberHistoryBorn>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub born_ext: Option<FamilyMemberHistoryBornExtension>,
    /** **(approximate) age**

 The age of the relative at the time the family member history is recorded.

 use estimatedAge to indicate whether the age is actual or not. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub age: Option<FamilyMemberHistoryAge>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub age_ext: Option<FamilyMemberHistoryAgeExtension>,
    /** **Age is estimated?**

 If true, indicates that the age value specified is an estimated value.

 This element is labeled as a modifier because the fact tha age is estimated can/should change the results of any algorithm that calculates based on the specified age. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "estimatedAge")]
    pub estimated_age: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_estimatedAge")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub estimated_age_ext: Option<FieldExtension>,
    /** **Dead? How old/when?**

 Deceased flag or the actual or approximate age of the relative at the time of death for the family member history record.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub deceased: Option<FamilyMemberHistoryDeceased>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub deceased_ext: Option<FamilyMemberHistoryDeceasedExtension>,
    /** **[FamilyHistoryReason](http://hl7.org/fhir/ValueSet/clinical-findings); Why was family member history performed?**

 Describes why the family member history occurred in coded or textual form.

 Textual reasons can be caprued using reasonCode.text. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonCode")]
    pub reason_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_code_ext: Vec<Option<FieldExtension>>,
    /** **Why was family member history performed?**

 Indicates a Condition, Observation, AllergyIntolerance, or QuestionnaireResponse that justifies this family member history event.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonReference")]
    pub reason_reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_reference_ext: Vec<Option<FieldExtension>>,
    /** **General note about related person**

 This property allows a non condition-specific note to the made about the related person. Ideally, the note would be in the condition property, but this is not always possible.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
    /** **Condition that the related person had**

 The significant Conditions (or condition) that the family member had. This is a repeating section to allow a system to represent more than one condition per resource, though there is nothing stopping multiple resources - one per condition.

 If none of the conditions listed have an outcome of "death" specified, that indicates that none of the specified conditions are known to have been the primary cause of death. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "condition")]
    pub condition: Vec<Option<FamilyMemberHistoryCondition>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_condition")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub condition_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl FamilyMemberHistoryBuilder {
    #[doc = concat!("Finalize building ", "FamilyMemberHistory", ".")]
    pub fn build(self) -> Result<FamilyMemberHistory, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<FamilyMemberHistoryInner> for FamilyMemberHistory {
    fn from(inner: FamilyMemberHistoryInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for FamilyMemberHistory {
    type Target = FamilyMemberHistoryInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for FamilyMemberHistory {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl FamilyMemberHistory {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> FamilyMemberHistoryBuilder {
        FamilyMemberHistoryBuilder::default()
    }
}
impl FamilyMemberHistory {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::FamilyMemberHistory
    }
}
/// Choice of types for the born[x] field in FamilyMemberHistory
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum FamilyMemberHistoryBorn {
    /// Variant accepting the Period type.
    #[serde(rename = "bornPeriod")]
    Period(Period),
    /// Variant accepting the Date type.
    #[serde(rename = "bornDate")]
    Date(Date),
    /// Variant accepting the String type.
    #[serde(rename = "bornString")]
    String(String),
}
/// Extension value for FamilyMemberHistoryBorn.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum FamilyMemberHistoryBornExtension {
    /// Variant accepting the Period extension.
    #[serde(rename = "_bornPeriod")]
    Period(FieldExtension),
    /// Variant accepting the Date extension.
    #[serde(rename = "_bornDate")]
    Date(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_bornString")]
    String(FieldExtension),
}
/// Choice of types for the age[x] field in FamilyMemberHistory
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum FamilyMemberHistoryAge {
    /// Variant accepting the Age type.
    #[serde(rename = "ageAge")]
    Age(Age),
    /// Variant accepting the Range type.
    #[serde(rename = "ageRange")]
    Range(Range),
    /// Variant accepting the String type.
    #[serde(rename = "ageString")]
    String(String),
}
/// Extension value for FamilyMemberHistoryAge.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum FamilyMemberHistoryAgeExtension {
    /// Variant accepting the Age extension.
    #[serde(rename = "_ageAge")]
    Age(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_ageRange")]
    Range(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_ageString")]
    String(FieldExtension),
}
/// Choice of types for the deceased[x] field in FamilyMemberHistory
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum FamilyMemberHistoryDeceased {
    /// Variant accepting the Boolean type.
    #[serde(rename = "deceasedBoolean")]
    Boolean(bool),
    /// Variant accepting the Age type.
    #[serde(rename = "deceasedAge")]
    Age(Age),
    /// Variant accepting the Range type.
    #[serde(rename = "deceasedRange")]
    Range(Range),
    /// Variant accepting the Date type.
    #[serde(rename = "deceasedDate")]
    Date(Date),
    /// Variant accepting the String type.
    #[serde(rename = "deceasedString")]
    String(String),
}
/// Extension value for FamilyMemberHistoryDeceased.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum FamilyMemberHistoryDeceasedExtension {
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_deceasedBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Age extension.
    #[serde(rename = "_deceasedAge")]
    Age(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_deceasedRange")]
    Range(FieldExtension),
    /// Variant accepting the Date extension.
    #[serde(rename = "_deceasedDate")]
    Date(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_deceasedString")]
    String(FieldExtension),
}
/// Sub-fields of the condition field in FamilyMemberHistory
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "FamilyMemberHistoryConditionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct FamilyMemberHistoryCondition {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ConditionCode](http://hl7.org/fhir/ValueSet/condition-code); Condition suffered by relation**

 The actual condition specified. Could be a coded condition (like MI or Diabetes) or a less specific string like 'cancer' depending on how much is known about the condition and the capabilities of the creating system.

 */
    #[serde(rename = "code")]
    pub code: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **[ConditionOutcome](http://hl7.org/fhir/ValueSet/condition-outcome); deceased | permanent disability | etc.**

 Indicates what happened as a result of this condition.  If the condition resulted in death, deceased date is captured on the relation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "outcome")]
    pub outcome: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_outcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub outcome_ext: Option<FieldExtension>,
    /** **When condition first manifested**

 Either the age of onset, range of approximate age or descriptive string can be recorded.  For conditions with multiple occurrences, this describes the first known occurrence.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub onset: Option<FamilyMemberHistoryConditionOnset>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub onset_ext: Option<FamilyMemberHistoryConditionOnsetExtension>,
    /** **Extra information about condition**

 An area where general notes can be placed about this specific condition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl FamilyMemberHistoryCondition {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> FamilyMemberHistoryConditionBuilder {
        FamilyMemberHistoryConditionBuilder::default()
    }
}
/// Choice of types for the onset[x] field in FamilyMemberHistoryCondition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum FamilyMemberHistoryConditionOnset {
    /// Variant accepting the Age type.
    #[serde(rename = "onsetAge")]
    Age(Age),
    /// Variant accepting the Range type.
    #[serde(rename = "onsetRange")]
    Range(Range),
    /// Variant accepting the Period type.
    #[serde(rename = "onsetPeriod")]
    Period(Period),
    /// Variant accepting the String type.
    #[serde(rename = "onsetString")]
    String(String),
}
/// Extension value for FamilyMemberHistoryConditionOnset.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum FamilyMemberHistoryConditionOnsetExtension {
    /// Variant accepting the Age extension.
    #[serde(rename = "_onsetAge")]
    Age(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_onsetRange")]
    Range(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_onsetPeriod")]
    Period(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_onsetString")]
    String(FieldExtension),
}
/** Base StructureDefinition for Flag Resource

 **[Flag](http://hl7.org/fhir/StructureDefinition/Flag) v3.0.2**

 Key information to flag to healthcare providers

 Prospective warnings of potential issues when providing care to the patient.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Flag(pub Box<FlagInner>);
/** Base StructureDefinition for Flag Resource

 **[Flag](http://hl7.org/fhir/StructureDefinition/Flag) v3.0.2**

 Key information to flag to healthcare providers

 Prospective warnings of potential issues when providing care to the patient.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "FlagBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct FlagInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Flag::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Flag", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business identifier**

 Identifier assigned to the flag for external use (outside the FHIR environment).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[FlagStatus](http://hl7.org/fhir/ValueSet/flag-status); active | inactive | entered-in-error**

 Supports basic workflow.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::FlagStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[FlagCategory](http://hl7.org/fhir/ValueSet/flag-category); Clinical, administrative, etc.**

 Allows an flag to be divided into different categories like clinical, administrative etc. Intended to be used as a means of filtering which flags are displayed to particular user or in a given context.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[FlagCode](http://hl7.org/fhir/ValueSet/flag-code); Coded or textual message to display to user**

 The coded value or textual component of the flag to display to the user.

 If non coded, use CodeableConcept.text.  This element should always be included in the narrative. */
    #[serde(rename = "code")]
    pub code: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Who/What is flag about?**

 The patient, location, group , organization , or practitioner, etc. this is about record this flag is associated with.

 */
    #[serde(rename = "subject")]
    pub subject: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Time period when flag is active**

 The period of time from the activation of the flag to inactivation of the flag. If the flag is active, the end of the period should be unspecified.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
    /** **Alert relevant during encounter**

 This alert is only relevant during the encounter.

 If both Flag.encounter and Flag.period are valued, then Flag.period.start shall not be before Encounter.period.start and Flag.period.end shall not be after Encounter.period.end. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "encounter")]
    pub encounter: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_encounter")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub encounter_ext: Option<FieldExtension>,
    /** **Flag creator**

 The person, organization or device that created the flag.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_author")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub author_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl FlagBuilder {
    #[doc = concat!("Finalize building ", "Flag", ".")]
    pub fn build(self) -> Result<Flag, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<FlagInner> for Flag {
    fn from(inner: FlagInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Flag {
    type Target = FlagInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Flag {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Flag {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> FlagBuilder {
        FlagBuilder::default()
    }
}
impl Flag {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Flag
    }
}
/** Base StructureDefinition for Goal Resource

 **[Goal](http://hl7.org/fhir/StructureDefinition/Goal) v3.0.2**

 Describes the intended objective(s) for a patient, group or organization

 Describes the intended objective(s) for a patient, group or organization care, for example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc.

 Goal can be achieving a particular change or merely maintaining a current state or even slowing a decline. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Goal(pub Box<GoalInner>);
/** Base StructureDefinition for Goal Resource

 **[Goal](http://hl7.org/fhir/StructureDefinition/Goal) v3.0.2**

 Describes the intended objective(s) for a patient, group or organization

 Describes the intended objective(s) for a patient, group or organization care, for example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc.

 Goal can be achieving a particular change or merely maintaining a current state or even slowing a decline. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "GoalBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct GoalInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Goal::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Goal", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **External Ids for this goal**

 This records identifiers associated with this care plan that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[GoalStatus](http://hl7.org/fhir/ValueSet/goal-status); proposed | accepted | planned | in-progress | on-target | ahead-of-target | behind-target | sustaining | achieved | on-hold | cancelled | entered-in-error | rejected**

 Indicates whether the goal has been reached and is still considered relevant.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::GoalStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[GoalCategory](http://hl7.org/fhir/ValueSet/goal-category); E.g. Treatment, dietary, behavioral, etc.**

 Indicates a category the goal falls within.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub category_ext: Vec<Option<FieldExtension>>,
    /** **[GoalPriority](http://hl7.org/fhir/ValueSet/goal-priority); high-priority | medium-priority | low-priority**

 Identifies the mutually agreed level of importance associated with reaching/sustaining the goal.

 Extensions are available to track priorities as established by each participant (i.e. Priority from the patient's perspective, different practitioners' perspectives, family member's perspectives)

The ordinal extension on Coding can be used to convey a numerically comparable ranking to priority.  (Keep in mind that different coding systems may use a "low value=important". */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "priority")]
    pub priority: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_priority")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub priority_ext: Option<FieldExtension>,
    /** **[GoalDescription](http://hl7.org/fhir/ValueSet/clinical-findings); Code or text describing goal**

 Human-readable and/or coded description of a specific desired objective of care, such as "control blood pressure" or "negotiate an obstacle course" or "dance with child at wedding".

 If no code is available, use CodeableConcept.text. */
    #[serde(rename = "description")]
    pub description: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Who this goal is intended for**

 Identifies the patient, group or organization for whom the goal is being established.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **When goal pursuit begins**

 The date or event after which the goal should begin being pursued.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub start: Option<GoalStart>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub start_ext: Option<GoalStartExtension>,
    /** **Target outcome for the goal**

 Indicates what should be done by when.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "target")]
    pub target: Option<GoalTarget>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_target")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub target_ext: Option<FieldExtension>,
    /** **When goal status took effect**

 Identifies when the current status.  I.e. When initially created, when achieved, when cancelled, etc.

 To see the date for past statuses, query history. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "statusDate")]
    pub status_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_statusDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_date_ext: Option<FieldExtension>,
    /** **Reason for current status**

 Captures the reason for the current status.

 This will typically be captured for statuses such as rejected, on-hold or cancelled, but could be present for others. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "statusReason")]
    pub status_reason: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_statusReason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_reason_ext: Option<FieldExtension>,
    /** **Who's responsible for creating Goal?**

 Indicates whose goal this is - patient goal, practitioner goal, etc.

 This is the individual reponsible for establishing the goal, not necessarily who recorded it.  (For that, use the Provenance resource.). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "expressedBy")]
    pub expressed_by: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_expressedBy")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub expressed_by_ext: Option<FieldExtension>,
    /** **Issues addressed by this goal**

 The identified conditions and other health record elements that are intended to be addressed by the goal.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "addresses")]
    pub addresses: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_addresses")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub addresses_ext: Vec<Option<FieldExtension>>,
    /** **Comments about the goal**

 Any comments related to the goal.

 May be used for progress notes, concerns or other related information that doesn't actually describe the goal itself. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
    /** **[GoalOutcome](http://hl7.org/fhir/ValueSet/clinical-findings); What result was achieved regarding the goal?**

 Identifies the change (or lack of change) at the point when the status of the goal is assessed.

 Note that this should not duplicate the goal status. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "outcomeCode")]
    pub outcome_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_outcomeCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub outcome_code_ext: Vec<Option<FieldExtension>>,
    /** **Observation that resulted from goal**

 Details of what's changed (or not changed).

 The goal outcome is independent of the outcome of the related activities.  For example, if the Goal is to achieve a target body weight of 150 lb and a care plan activity is defined to diet, then the care plan’s activity outcome could be calories consumed whereas goal outcome is an observation for the actual body weight measured. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "outcomeReference")]
    pub outcome_reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_outcomeReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub outcome_reference_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl GoalBuilder {
    #[doc = concat!("Finalize building ", "Goal", ".")]
    pub fn build(self) -> Result<Goal, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<GoalInner> for Goal {
    fn from(inner: GoalInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Goal {
    type Target = GoalInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Goal {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Goal {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> GoalBuilder {
        GoalBuilder::default()
    }
}
impl Goal {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Goal
    }
}
/// Choice of types for the start[x] field in Goal
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum GoalStart {
    /// Variant accepting the Date type.
    #[serde(rename = "startDate")]
    Date(Date),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "startCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for GoalStart.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum GoalStartExtension {
    /// Variant accepting the Date extension.
    #[serde(rename = "_startDate")]
    Date(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_startCodeableConcept")]
    CodeableConcept(FieldExtension),
}
/// Sub-fields of the target field in Goal
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "GoalTargetBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct GoalTarget {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[GoalTargetMeasure](http://hl7.org/fhir/ValueSet/observation-codes); The parameter whose value is being tracked**

 The parameter whose value is being tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "measure")]
    pub measure: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_measure")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub measure_ext: Option<FieldExtension>,
    /** **The target value to be achieved**

 The target value of the focus to be achieved to signify the fulfillment of the goal, e.g. 150 pounds, 7.0%. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any focus value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any focus value at or above the low value.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub detail: Option<GoalTargetDetail>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub detail_ext: Option<GoalTargetDetailExtension>,
    /** **Reach goal on or before**

 Indicates either the date or the duration after start by which the goal should be met.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub due: Option<GoalTargetDue>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub due_ext: Option<GoalTargetDueExtension>,
}
#[cfg(feature = "builders")]
impl GoalTarget {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> GoalTargetBuilder {
        GoalTargetBuilder::default()
    }
}
/// Choice of types for the detail[x] field in GoalTarget
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum GoalTargetDetail {
    /// Variant accepting the Quantity type.
    #[serde(rename = "detailQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Range type.
    #[serde(rename = "detailRange")]
    Range(Range),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "detailCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for GoalTargetDetail.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum GoalTargetDetailExtension {
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_detailQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_detailRange")]
    Range(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_detailCodeableConcept")]
    CodeableConcept(FieldExtension),
}
/// Choice of types for the due[x] field in GoalTarget
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum GoalTargetDue {
    /// Variant accepting the Date type.
    #[serde(rename = "dueDate")]
    Date(Date),
    /// Variant accepting the Duration type.
    #[serde(rename = "dueDuration")]
    Duration(Duration),
}
/// Extension value for GoalTargetDue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum GoalTargetDueExtension {
    /// Variant accepting the Date extension.
    #[serde(rename = "_dueDate")]
    Date(FieldExtension),
    /// Variant accepting the Duration extension.
    #[serde(rename = "_dueDuration")]
    Duration(FieldExtension),
}
/** Base StructureDefinition for GraphDefinition Resource

 **[GraphDefinition](http://hl7.org/fhir/StructureDefinition/GraphDefinition) v3.0.2**

 Definition of an graph of resources

 A formal computable definition of a graph of resources - that is, a coherent set of resources that form a graph by following references. The Graph Definition resource defines a set and makes rules about the set.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct GraphDefinition(pub Box<GraphDefinitionInner>);
/** Base StructureDefinition for GraphDefinition Resource

 **[GraphDefinition](http://hl7.org/fhir/StructureDefinition/GraphDefinition) v3.0.2**

 Definition of an graph of resources

 A formal computable definition of a graph of resources - that is, a coherent set of resources that form a graph by following references. The Graph Definition resource defines a set and makes rules about the set.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "GraphDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct GraphDefinitionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "GraphDefinition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::GraphDefinition", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical URI to reference this graph definition (globally unique)**

 An absolute URI that is used to identify this graph definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this graph definition is (or will be) published. The URL SHOULD include the major version of the graph definition. For more information see [Technical and Business Versions](resource.html#versions).

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred.  Multiple instances may share the same url if they have a distinct version. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "url")]
    pub url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Business version of the graph definition**

 The identifier that is used to identify this version of the graph definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the graph definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.

 There may be different graph definition instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a refrence to a particular business version of the graph definition with the format [url]|[version]. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Name for this graph definition (computer friendly)**

 A natural language name identifying the graph definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.

 The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure that it is computable friendly. */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this graph definition. Enables tracking the life-cycle of the content.

 Allows filtering of graph definitions that are appropriate for use vs. not.
This is labeled as "Is Modifier" because applications should not use a retired graph definition without due consideration. */
    #[serde(rename = "status")]
    pub status: codes::PublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **For testing purposes, not real usage**

 A boolean value to indicate that this graph definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of graph definition that are appropriate for use vs. not. This is labeled as "Is Modifier" because applications should not use an experimental graph definition in production. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "experimental")]
    pub experimental: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_experimental")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub experimental_ext: Option<FieldExtension>,
    /** **Date this was last changed**

 The date  (and optionally time) when the graph definition was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the graph definition changes.

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the graph definition. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Name of the publisher (organization or individual)**

 The name of the individual or organization that published the graph definition.

 Usually an organization, but may be an individual. The publisher (or steward) of the graph definition is the organization or individual primarily responsible for the maintenance and upkeep of the graph definition. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the graph definition. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisher")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_ext: Option<FieldExtension>,
    /** **Contact details for the publisher**

 Contact details to assist a user in finding and communicating with the publisher.

 May be a web site, an email address, a telephone number, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Natural language description of the graph definition**

 A free text natural language description of the graph definition from a consumer's perspective.

 This description can be used to capture details such as why the graph definition was built, comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the graph definition as conveyed in the 'text' field of the resource itself. This item SHOULD be populated unless the information is available from context (e.g. the language of the profile is presumed to be the predominant language in the place the profile was created). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Context the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate graph definition instances.

 When multiple useContexts are specified, there is no expectation whether all or any of the contexts apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useContext")]
    pub use_context: Vec<Option<UsageContext>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_useContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_context_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Intended jurisdiction for graph definition (if applicable)**

 A legal or geographic region in which the graph definition is intended to be used.

 It may be possible for the graph definition to be used in jurisdictions other than those for which it was originally designed or intended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **Why this graph definition is defined**

 Explaination of why this graph definition is needed and why it has been designed as it has.

 This element does not describe the usage of the graph definition Instead  it provides traceability of ''why'' the resource is either needed or ''why'' it is defined as it is.  This may be used to point to source materials or specifications that drove the structure of this graph definition. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purpose")]
    pub purpose: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_purpose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub purpose_ext: Option<FieldExtension>,
    /** **[ResourceType](http://hl7.org/fhir/ValueSet/resource-types); Type of resource at which the graph starts**

 The type of FHIR resource at which instances of this graph start.

 */
    #[serde(rename = "start")]
    pub start: codes::ResourceType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_start")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub start_ext: Option<FieldExtension>,
    /** **Profile on base resource**

 The profile that describes the use of the base resource.

 The code does not include the '$' prefix that is always included in the URL when the operation is invoked. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "profile")]
    pub profile: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_profile")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub profile_ext: Option<FieldExtension>,
    /** **Links this graph makes rules about**

 Links this graph makes rules about.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "link")]
    pub link: Vec<Option<GraphDefinitionLink>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_link")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub link_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl GraphDefinitionBuilder {
    #[doc = concat!("Finalize building ", "GraphDefinition", ".")]
    pub fn build(self) -> Result<GraphDefinition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<GraphDefinitionInner> for GraphDefinition {
    fn from(inner: GraphDefinitionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for GraphDefinition {
    type Target = GraphDefinitionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for GraphDefinition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl GraphDefinition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> GraphDefinitionBuilder {
        GraphDefinitionBuilder::default()
    }
}
impl GraphDefinition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::GraphDefinition
    }
}
/// Sub-fields of the link field in GraphDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "GraphDefinitionLinkBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct GraphDefinitionLink {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Path in the resource that contains the link**

 Path in the resource that contains the link.

 The path can be a literal path (e.g. Observation.subject), or it can be a query for reverse links (e.g. Provenance?target=[id]). */
    #[serde(rename = "path")]
    pub path: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_path")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub path_ext: Option<FieldExtension>,
    /** **Which slice (if profiled)**

 Which slice (if profiled).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sliceName")]
    pub slice_name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sliceName")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub slice_name_ext: Option<FieldExtension>,
    /** **Minimum occurrences for this link**

 Minimum occurrences for this link.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "min")]
    pub min: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_min")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub min_ext: Option<FieldExtension>,
    /** **Maximum occurrences for this link**

 Maximum occurrences for this link.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "max")]
    pub max: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_max")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub max_ext: Option<FieldExtension>,
    /** **Why this link is specified**

 Information about why this link is of interest in this graph definition.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Potential target for the link**

 Potential target for the link.

 */
    #[serde(rename = "target")]
    pub target: Vec<Option<GraphDefinitionLinkTarget>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_target")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub target_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl GraphDefinitionLink {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> GraphDefinitionLinkBuilder {
        GraphDefinitionLinkBuilder::default()
    }
}
/// Sub-fields of the target field in GraphDefinitionLink
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "GraphDefinitionLinkTargetBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct GraphDefinitionLinkTarget {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ResourceType](http://hl7.org/fhir/ValueSet/resource-types); Type of resource this link refers to**

 Type of resource this link refers to.

 */
    #[serde(rename = "type")]
    pub r#type: codes::ResourceType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Profile for the target resource**

 Profile for the target resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "profile")]
    pub profile: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_profile")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub profile_ext: Option<FieldExtension>,
    /** **Compartment Consistency Rules**

 Compartment Consistency Rules.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "compartment")]
    pub compartment: Vec<Option<GraphDefinitionLinkTargetCompartment>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_compartment")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub compartment_ext: Vec<Option<FieldExtension>>,
    /** **Additional links from target resource**

 Additional links from target resource.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "link")]
    pub link: Vec<Option<GraphDefinitionLink>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_link")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub link_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl GraphDefinitionLinkTarget {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> GraphDefinitionLinkTargetBuilder {
        GraphDefinitionLinkTargetBuilder::default()
    }
}
/// Sub-fields of the compartment field in GraphDefinitionLinkTarget
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "GraphDefinitionLinkTargetCompartmentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct GraphDefinitionLinkTargetCompartment {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[CompartmentCode](http://hl7.org/fhir/ValueSet/compartment-type); Identifies the compartment**

 Identifies the compartment.

 */
    #[serde(rename = "code")]
    pub code: codes::CompartmentType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **[GraphCompartmentRule](http://hl7.org/fhir/ValueSet/graph-compartment-rule); identical | matching | different | custom**

 identical | matching | different | no-rule | custom.

 */
    #[serde(rename = "rule")]
    pub rule: codes::GraphCompartmentRule,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_rule")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub rule_ext: Option<FieldExtension>,
    /** **Custom rule, as a FHIRPath expression**

 Custom rule, as a FHIRPath expression.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "expression")]
    pub expression: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_expression")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub expression_ext: Option<FieldExtension>,
    /** **Documentation for FHIRPath expression**

 Documentation for FHIRPath expression.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl GraphDefinitionLinkTargetCompartment {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> GraphDefinitionLinkTargetCompartmentBuilder {
        GraphDefinitionLinkTargetCompartmentBuilder::default()
    }
}
/** Base StructureDefinition for Group Resource

 **[Group](http://hl7.org/fhir/StructureDefinition/Group) v3.0.2**

 Group of multiple entities

 Represents a defined collection of entities that may be discussed or acted upon collectively but which are not expected to act collectively and are not formally or legally recognized; i.e. a collection of entities that isn't an Organization.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Group(pub Box<GroupInner>);
/** Base StructureDefinition for Group Resource

 **[Group](http://hl7.org/fhir/StructureDefinition/Group) v3.0.2**

 Group of multiple entities

 Represents a defined collection of entities that may be discussed or acted upon collectively but which are not expected to act collectively and are not formally or legally recognized; i.e. a collection of entities that isn't an Organization.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "GroupBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct GroupInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Group::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Group", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Unique id**

 A unique business identifier for this group.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Whether this group's record is in active use**

 Indicates whether the record for the group is available for use or is merely being retained for historical purposes.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "active")]
    pub active: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_active")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub active_ext: Option<FieldExtension>,
    /** **[GroupType](http://hl7.org/fhir/ValueSet/group-type); person | animal | practitioner | device | medication | substance**

 Identifies the broad classification of the kind of resources the group includes.

 Group members SHALL be of the appropriate resource type (Patient for person or animal; or Practitioner, Device, Medicaiton or Substance for the other types.). */
    #[serde(rename = "type")]
    pub r#type: codes::GroupType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Descriptive or actual**

 If true, indicates that the resource refers to a specific group of real individuals.  If false, the group defines a set of intended individuals.

 */
    #[serde(rename = "actual")]
    pub actual: bool,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_actual")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub actual_ext: Option<FieldExtension>,
    /** **[GroupKind](); Kind of Group members**

 Provides a specific type of resource the group includes; e.g. "cow", "syringe", etc.

 This would generally be omitted for Person resources. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Label for Group**

 A label assigned to the group for human identification and communication.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Number of members**

 A count of the number of resource instances that are part of the group.

 Note that the quantity may be less than the number of members if some of the members are not active. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<u32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_quantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<FieldExtension>,
    /** **Trait of group members**

 Identifies the traits shared by members of the group.

 All the identified characteristics must be true for an entity to a member of the group. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "characteristic")]
    pub characteristic: Vec<Option<GroupCharacteristic>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_characteristic")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub characteristic_ext: Vec<Option<FieldExtension>>,
    /** **Who or what is in group**

 Identifies the resource instances that are members of the group.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "member")]
    pub member: Vec<Option<GroupMember>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_member")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub member_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl GroupBuilder {
    #[doc = concat!("Finalize building ", "Group", ".")]
    pub fn build(self) -> Result<Group, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<GroupInner> for Group {
    fn from(inner: GroupInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Group {
    type Target = GroupInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Group {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Group {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> GroupBuilder {
        GroupBuilder::default()
    }
}
impl Group {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Group
    }
}
/// Sub-fields of the characteristic field in Group
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "GroupCharacteristicBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct GroupCharacteristic {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[GroupCharacteristicKind](); Kind of characteristic**

 A code that identifies the kind of trait being asserted.

 */
    #[serde(rename = "code")]
    pub code: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Value held by characteristic**

 The value of the trait that holds (or does not hold - see 'exclude') for members of the group.

 For Range, it means members of the group have a value that falls somewhere within the specified range. */
    #[serde(flatten)]
    pub value: GroupCharacteristicValue,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<GroupCharacteristicValueExtension>,
    /** **Group includes or excludes**

 If true, indicates the characteristic is one that is NOT held by members of the group.

 This is labeled as "Is Modifier" because applications cannot wrongly include excluded members as included or vice versa. */
    #[serde(rename = "exclude")]
    pub exclude: bool,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_exclude")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub exclude_ext: Option<FieldExtension>,
    /** **Period over which characteristic is tested**

 The period over which the characteristic is tested; e.g. the patient had an operation during the month of June.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl GroupCharacteristic {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> GroupCharacteristicBuilder {
        GroupCharacteristicBuilder::default()
    }
}
/// Choice of types for the value[x] field in GroupCharacteristic
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum GroupCharacteristicValue {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "valueCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Range type.
    #[serde(rename = "valueRange")]
    Range(Range),
}
/// Extension value for GroupCharacteristicValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum GroupCharacteristicValueExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_valueCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_valueRange")]
    Range(FieldExtension),
}
/// Sub-fields of the member field in Group
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "GroupMemberBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct GroupMember {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Reference to the group member**

 A reference to the entity that is a member of the group. Must be consistent with Group.type.

 */
    #[serde(rename = "entity")]
    pub entity: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_entity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub entity_ext: Option<FieldExtension>,
    /** **Period member belonged to the group**

 The period that the member was in the group, if known.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
    /** **If member is no longer in group**

 A flag to indicate that the member is no longer in the group, but previously may have been a member.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "inactive")]
    pub inactive: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_inactive")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub inactive_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl GroupMember {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> GroupMemberBuilder {
        GroupMemberBuilder::default()
    }
}
/** Base StructureDefinition for GuidanceResponse Resource

 **[GuidanceResponse](http://hl7.org/fhir/StructureDefinition/GuidanceResponse) v3.0.2**

 The formal response to a guidance request

 A guidance response is the formal response to a guidance request, including any output parameters returned by the evaluation, as well as the description of any proposed actions to be taken.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct GuidanceResponse(pub Box<GuidanceResponseInner>);
/** Base StructureDefinition for GuidanceResponse Resource

 **[GuidanceResponse](http://hl7.org/fhir/StructureDefinition/GuidanceResponse) v3.0.2**

 The formal response to a guidance request

 A guidance response is the formal response to a guidance request, including any output parameters returned by the evaluation, as well as the description of any proposed actions to be taken.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "GuidanceResponseBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct GuidanceResponseInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "GuidanceResponse::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::GuidanceResponse", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **The id of the request associated with this response, if any**

 The id of the request associated with this response. If an id was given as part of the request, it will be reproduced here to enable the requester to more easily identify the response in a multi-request scenario.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requestId")]
    pub request_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requestId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_id_ext: Option<FieldExtension>,
    /** **Business identifier**

 Allows a service to provide a unique, business identifier for the response.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **A reference to a knowledge module**

 A reference to the knowledge module that was invoked.

 */
    #[serde(rename = "module")]
    pub module: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_module")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub module_ext: Option<FieldExtension>,
    /** **[GuidanceResponseStatus](http://hl7.org/fhir/ValueSet/guidance-response-status); success | data-requested | data-required | in-progress | failure | entered-in-error**

 The status of the response. If the evaluation is completed successfully, the status will indicate success. However, in order to complete the evaluation, the engine may require more information. In this case, the status will be data-required, and the response will contain a description of the additional required information. If the evaluation completed successfully, but the engine determines that a potentially more accurate response could be provided if more data was available, the status will be data-requested, and the response will contain a description of the additional requested information.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::GuidanceResponseStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **Patient the request was performed for**

 The patient for which the request was processed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Encounter or Episode during which the response was returned**

 Allows the context of the guidance response to be provided if available. In a service context, this would likely be unavailable.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **When the guidance response was processed**

 Indicates when the guidance response was processed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "occurrenceDateTime")]
    pub occurrence_date_time: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_occurrenceDateTime")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub occurrence_date_time_ext: Option<FieldExtension>,
    /** **Device returning the guidance**

 Provides a reference to the device that performed the guidance.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_performer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub performer_ext: Option<FieldExtension>,
    /** **Reason for the response**

 Indicates the reason the request was initiated. This is typically provided as a parameter to the evaluation and echoed by the service, although for some use cases, such as subscription- or event-based scenarios, it may provide an indication of the cause for the response.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub reason: Option<GuidanceResponseReason>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reason_ext: Option<GuidanceResponseReasonExtension>,
    /** **Additional notes about the response**

 Provides a mechanism to communicate additional information about the response.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
    /** **Messages resulting from the evaluation of the artifact or artifacts**

 Messages resulting from the evaluation of the artifact or artifacts. As part of evaluating the request, the engine may produce informational or warning messages. These messages will be provided by this element.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "evaluationMessage")]
    pub evaluation_message: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_evaluationMessage")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub evaluation_message_ext: Vec<Option<FieldExtension>>,
    /** **The output parameters of the evaluation, if any**

 The output parameters of the evaluation, if any. Many modules will result in the return of specific resources such as procedure or communication requests that are returned as part of the operation result. However, modules may define specific outputs that would be returned as the result of the evaluation, and these would be returned in this element.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "outputParameters")]
    pub output_parameters: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_outputParameters")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub output_parameters_ext: Option<FieldExtension>,
    /** **Proposed actions, if any**

 The actions, if any, produced by the evaluation of the artifact.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "result")]
    pub result: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_result")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub result_ext: Option<FieldExtension>,
    /** **Additional required data**

 If the evaluation could not be completed due to lack of information, or additional information would potentially result in a more accurate response, this element will a description of the data required in order to proceed with the evaluation. A subsequent request to the service should include this data.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dataRequirement")]
    pub data_requirement: Vec<Option<DataRequirement>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_dataRequirement")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub data_requirement_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl GuidanceResponseBuilder {
    #[doc = concat!("Finalize building ", "GuidanceResponse", ".")]
    pub fn build(self) -> Result<GuidanceResponse, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<GuidanceResponseInner> for GuidanceResponse {
    fn from(inner: GuidanceResponseInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for GuidanceResponse {
    type Target = GuidanceResponseInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for GuidanceResponse {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl GuidanceResponse {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> GuidanceResponseBuilder {
        GuidanceResponseBuilder::default()
    }
}
impl GuidanceResponse {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::GuidanceResponse
    }
}
/// Choice of types for the reason[x] field in GuidanceResponse
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum GuidanceResponseReason {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "reasonCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "reasonReference")]
    Reference(Reference),
}
/// Extension value for GuidanceResponseReason.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum GuidanceResponseReasonExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_reasonCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_reasonReference")]
    Reference(FieldExtension),
}
/** Base StructureDefinition for HealthcareService Resource

 **[HealthcareService](http://hl7.org/fhir/StructureDefinition/HealthcareService) v3.0.2**

 The details of a healthcare service available at a location

 The details of a healthcare service available at a location.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct HealthcareService(pub Box<HealthcareServiceInner>);
/** Base StructureDefinition for HealthcareService Resource

 **[HealthcareService](http://hl7.org/fhir/StructureDefinition/HealthcareService) v3.0.2**

 The details of a healthcare service available at a location

 The details of a healthcare service available at a location.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "HealthcareServiceBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct HealthcareServiceInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "HealthcareService::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::HealthcareService", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **External identifiers for this item**

 External identifiers for this item.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Whether this healthcareservice is in active use**

 Whether this healthcareservice record is in active use.

 This element is labeled as a modifier because it may be used to mark that the resource was created in error. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "active")]
    pub active: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_active")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub active_ext: Option<FieldExtension>,
    /** **Organization that provides this service**

 The organization that provides this healthcare service.

 This property is recommended to be the same as the Location's managingOrganization, and if not provided should be interpreted as such. If the Location does not have a managing Organization, then this property should be populated. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "providedBy")]
    pub provided_by: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_providedBy")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub provided_by_ext: Option<FieldExtension>,
    /** **[service-category](http://hl7.org/fhir/ValueSet/service-category); Broad category of service being performed or delivered**

 Identifies the broad category of service being performed or delivered.

 Selecting a Service Category then determines the list of relevant service types that can be selected in the primary service type. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[service-type](http://hl7.org/fhir/ValueSet/service-type); Type of service that may be delivered or performed**

 The specific type of service that may be delivered or performed.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub r#type_ext: Vec<Option<FieldExtension>>,
    /** **[service-specialty](http://hl7.org/fhir/ValueSet/c80-practice-codes); Specialties handled by the HealthcareService**

 Collection of specialties handled by the service site. This is more of a medical term.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "specialty")]
    pub specialty: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_specialty")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub specialty_ext: Vec<Option<FieldExtension>>,
    /** **Location(s) where service may be provided**

 The location(s) where this healthcare service may be provided.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "location")]
    pub location: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_location")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub location_ext: Vec<Option<FieldExtension>>,
    /** **Description of service as presented to a consumer while searching**

 Further description of the service as it would be presented to a consumer while searching.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Additional description and/or any specific issues not covered elsewhere**

 Any additional description of the service and/or any specific issues not covered by the other attributes, which can be displayed as further detail under the serviceName.

 Would expect that a user would not see this information on a search results, and it would only be available when viewing the complete details of the service. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "comment")]
    pub comment: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_comment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub comment_ext: Option<FieldExtension>,
    /** **Extra details about the service that can't be placed in the other fields**

 Extra details about the service that can't be placed in the other fields.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extraDetails")]
    pub extra_details: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_extraDetails")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub extra_details_ext: Option<FieldExtension>,
    /** **Facilitates quick identification of the service**

 If there is a photo/symbol associated with this HealthcareService, it may be included here to facilitate quick identification of the service in a list.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "photo")]
    pub photo: Option<Attachment>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_photo")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub photo_ext: Option<FieldExtension>,
    /** **Contacts related to the healthcare service**

 List of contacts related to this specific healthcare service.

 If this is empty, then refer to the location's contacts. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "telecom")]
    pub telecom: Vec<Option<ContactPoint>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_telecom")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub telecom_ext: Vec<Option<FieldExtension>>,
    /** **Location(s) service is inteded for/available to**

 The location(s) that this service is available to (not where the service is provided).

 The locations referenced by the coverage area can include both specific locations, including areas, and also conceptual domains too (mode = kind), such as a physical area (tri-state area) and some other attribute (covered by Example Care Organization). These types of Locations are often not managed by any specific organization. This could also include generic locations such as "in-home". */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "coverageArea")]
    pub coverage_area: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_coverageArea")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub coverage_area_ext: Vec<Option<FieldExtension>>,
    /** **[ServiceProvisionConditions](http://hl7.org/fhir/ValueSet/service-provision-conditions); Conditions under which service is available/offered**

 The code(s) that detail the conditions under which the healthcare service is available/offered.

 The provision means being commissioned by, contractually obliged or financially sourced. Types of costings that may apply to this healthcare service, such if the service may be available for free, some discounts available, or fees apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "serviceProvisionCode")]
    pub service_provision_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_serviceProvisionCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub service_provision_code_ext: Vec<Option<FieldExtension>>,
    /** **[ServiceEligibility](); Specific eligibility requirements required to use the service**

 Does this service have specific eligibility requirements that need to be met in order to use the service?

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "eligibility")]
    pub eligibility: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_eligibility")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub eligibility_ext: Option<FieldExtension>,
    /** **Describes the eligibility conditions for the service**

 Describes the eligibility conditions for the service.

 The description of service eligibility should, in general, not exceed one or two paragraphs. It should be sufficient for a prospective consumer to determine if they are likely to be eligible or not. Where eligibility requirements and conditions are complex, it may simply be noted that an eligibility assessment is required. Where eligibility is determined by an outside source, such as an Act of Parliament, this should be noted, preferably with a reference to a commonly available copy of the source document such as a web page. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "eligibilityNote")]
    pub eligibility_note: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_eligibilityNote")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub eligibility_note_ext: Option<FieldExtension>,
    /** **Program Names that categorize the service**

 Program Names that can be used to categorize the service.

 Programs are often defined externally to an Organization, commonly by governments; e.g. Home and Community Care Programs, Homeless Program, …. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "programName")]
    pub program_name: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_programName")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub program_name_ext: Vec<Option<FieldExtension>>,
    /** **[ServiceCharacteristic](); Collection of characteristics (attributes)**

 Collection of characteristics (attributes).

 These could be such things as is wheelchair accessible. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "characteristic")]
    pub characteristic: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_characteristic")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub characteristic_ext: Vec<Option<FieldExtension>>,
    /** **[ReferralMethod](http://hl7.org/fhir/ValueSet/service-referral-method); Ways that the service accepts referrals**

 Ways that the service accepts referrals, if this is not provided then it is implied that no referral is required.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "referralMethod")]
    pub referral_method: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_referralMethod")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub referral_method_ext: Vec<Option<FieldExtension>>,
    /** **If an appointment is required for access to this service**

 Indicates whether or not a prospective consumer will require an appointment for a particular service at a site to be provided by the Organization. Indicates if an appointment is required for access to this service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "appointmentRequired")]
    pub appointment_required: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_appointmentRequired")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub appointment_required_ext: Option<FieldExtension>,
    /** **Times the Service Site is available**

 A collection of times that the Service Site is available.

 More detailed availability information may be provided in associated Schedule/Slot resources. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "availableTime")]
    pub available_time: Vec<Option<HealthcareServiceAvailableTime>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_availableTime")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub available_time_ext: Vec<Option<FieldExtension>>,
    /** **Not available during this time due to provided reason**

 The HealthcareService is not available during this period of time due to the provided reason.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "notAvailable")]
    pub not_available: Vec<Option<HealthcareServiceNotAvailable>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_notAvailable")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub not_available_ext: Vec<Option<FieldExtension>>,
    /** **Description of availability exceptions**

 A description of site availability exceptions, e.g. public holiday availability. Succinctly describing all possible exceptions to normal site availability as details in the available Times and not available Times.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "availabilityExceptions")]
    pub availability_exceptions: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_availabilityExceptions")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub availability_exceptions_ext: Option<FieldExtension>,
    /** **Technical endpoints providing access to services operated for the location**

 Technical endpoints providing access to services operated for the specific healthcare services defined at this resource.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endpoint")]
    pub endpoint: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_endpoint")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub endpoint_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl HealthcareServiceBuilder {
    #[doc = concat!("Finalize building ", "HealthcareService", ".")]
    pub fn build(self) -> Result<HealthcareService, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<HealthcareServiceInner> for HealthcareService {
    fn from(inner: HealthcareServiceInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for HealthcareService {
    type Target = HealthcareServiceInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for HealthcareService {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl HealthcareService {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> HealthcareServiceBuilder {
        HealthcareServiceBuilder::default()
    }
}
impl HealthcareService {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::HealthcareService
    }
}
/// Sub-fields of the availableTime field in HealthcareService
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "HealthcareServiceAvailableTimeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct HealthcareServiceAvailableTime {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DaysOfWeek](http://hl7.org/fhir/ValueSet/days-of-week); mon | tue | wed | thu | fri | sat | sun**

 Indicates which days of the week are available between the start and end Times.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "daysOfWeek")]
    pub days_of_week: Vec<Option<codes::DaysOfWeek>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_daysOfWeek")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub days_of_week_ext: Vec<Option<FieldExtension>>,
    /** **Always available? e.g. 24 hour service**

 Is this always available? (hence times are irrelevant) e.g. 24 hour service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "allDay")]
    pub all_day: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_allDay")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub all_day_ext: Option<FieldExtension>,
    /** **Opening time of day (ignored if allDay = true)**

 The opening time of day. Note: If the AllDay flag is set, then this time is ignored.

 The timezone is expected to be for where this HealthcareService is provided at. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "availableStartTime")]
    pub available_start_time: Option<Time>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_availableStartTime")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub available_start_time_ext: Option<FieldExtension>,
    /** **Closing time of day (ignored if allDay = true)**

 The closing time of day. Note: If the AllDay flag is set, then this time is ignored.

 The timezone is expected to be for where this HealthcareService is provided at. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "availableEndTime")]
    pub available_end_time: Option<Time>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_availableEndTime")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub available_end_time_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl HealthcareServiceAvailableTime {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> HealthcareServiceAvailableTimeBuilder {
        HealthcareServiceAvailableTimeBuilder::default()
    }
}
/// Sub-fields of the notAvailable field in HealthcareService
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "HealthcareServiceNotAvailableBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct HealthcareServiceNotAvailable {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Reason presented to the user explaining why time not available**

 The reason that can be presented to the user as to why this time is not available.

 */
    #[serde(rename = "description")]
    pub description: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Service not availablefrom this date**

 Service is not available (seasonally or for a public holiday) from this date.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "during")]
    pub during: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_during")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub during_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl HealthcareServiceNotAvailable {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> HealthcareServiceNotAvailableBuilder {
        HealthcareServiceNotAvailableBuilder::default()
    }
}
/** Base StructureDefinition for ImagingManifest Resource

 **[ImagingManifest](http://hl7.org/fhir/StructureDefinition/ImagingManifest) v3.0.2**

 Key Object Selection

 A text description of the DICOM SOP instances selected in the ImagingManifest; or the reason for, or significance of, the selection.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ImagingManifest(pub Box<ImagingManifestInner>);
/** Base StructureDefinition for ImagingManifest Resource

 **[ImagingManifest](http://hl7.org/fhir/StructureDefinition/ImagingManifest) v3.0.2**

 Key Object Selection

 A text description of the DICOM SOP instances selected in the ImagingManifest; or the reason for, or significance of, the selection.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImagingManifestBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ImagingManifestInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ImagingManifest::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ImagingManifest", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **SOP Instance UID**

 Unique identifier of the DICOM Key Object Selection (KOS) that this resource represents.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **Patient of the selected objects**

 A patient resource reference which is the patient subject of all DICOM SOP Instances in this ImagingManifest.

 SOP instances selected in the ImagingManifest can be from different studies, but must be of the same patient. */
    #[serde(rename = "patient")]
    pub patient: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_ext: Option<FieldExtension>,
    /** **Time when the selection of instances was made**

 Date and time when the selection of the referenced instances were made. It is (typically) different from the creation date of the selection resource, and from dates associated with the referenced instances (e.g. capture time of the referenced image).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authoringTime")]
    pub authoring_time: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_authoringTime")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub authoring_time_ext: Option<FieldExtension>,
    /** **Author (human or machine)**

 Author of ImagingManifest. It can be a human author or a device which made the decision of the SOP instances selected. For example, a radiologist selected a set of imaging SOP instances to attach in a diagnostic report, and a CAD application may author a selection to describe SOP instances it used to generate a detection conclusion.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_author")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub author_ext: Option<FieldExtension>,
    /** **Description text**

 Free text narrative description of the ImagingManifest.
The value may be derived from the DICOM Standard Part 16, CID-7010 descriptions (e.g. Best in Set, Complete Study Content). Note that those values cover the wide range of uses of the DICOM Key Object Selection object, several of which are not supported by ImagingManifest. Specifically, there is no expected behavior associated with descriptions that suggest referenced images be removed or not used.

 Free text narrative description of the ImagingManifest. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Study identity of the selected instances**

 Study identity and locating information of the DICOM SOP instances in the selection.

 Study component represents the study level identity and locator information of the DICOM SOP instances in the selection. It is the top level identity of the hierarchical identification of the instances. */
    #[serde(rename = "study")]
    pub study: Vec<Option<ImagingManifestStudy>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_study")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub study_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ImagingManifestBuilder {
    #[doc = concat!("Finalize building ", "ImagingManifest", ".")]
    pub fn build(self) -> Result<ImagingManifest, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ImagingManifestInner> for ImagingManifest {
    fn from(inner: ImagingManifestInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ImagingManifest {
    type Target = ImagingManifestInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ImagingManifest {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ImagingManifest {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ImagingManifestBuilder {
        ImagingManifestBuilder::default()
    }
}
impl ImagingManifest {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ImagingManifest
    }
}
/// Sub-fields of the study field in ImagingManifest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImagingManifestStudyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImagingManifestStudy {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Study instance UID**

 Study instance UID of the SOP instances in the selection.

 */
    #[serde(rename = "uid")]
    pub uid: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_uid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub uid_ext: Option<FieldExtension>,
    /** **Reference to ImagingStudy**

 Reference to the Imaging Study in FHIR form.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "imagingStudy")]
    pub imaging_study: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_imagingStudy")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub imaging_study_ext: Option<FieldExtension>,
    /** **Study access service endpoint**

 The network service providing access (e.g., query, view, or retrieval) for the study. See implementation notes for information about using DICOM endpoints. A study-level endpoint applies to each series in the study, unless overridden by a series-level endpoint with the same Endpoint.type.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endpoint")]
    pub endpoint: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_endpoint")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub endpoint_ext: Vec<Option<FieldExtension>>,
    /** **Series identity of the selected instances**

 Series identity and locating information of the DICOM SOP instances in the selection.

 Series component represents the series level identity and locator information of the DICOM SOP instances in the selection. */
    #[serde(rename = "series")]
    pub series: Vec<Option<ImagingManifestStudySeries>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_series")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub series_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ImagingManifestStudy {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImagingManifestStudyBuilder {
        ImagingManifestStudyBuilder::default()
    }
}
/// Sub-fields of the series field in ImagingManifestStudy
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImagingManifestStudySeriesBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImagingManifestStudySeries {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Series instance UID**

 Series instance UID of the SOP instances in the selection.

 */
    #[serde(rename = "uid")]
    pub uid: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_uid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub uid_ext: Option<FieldExtension>,
    /** **Series access endpoint**

 The network service providing access (e.g., query, view, or retrieval) for this series. See implementation notes for information about using DICOM endpoints. A series-level endpoint, if present, has precedence over a study-level endpoint with the same Endpoint.type.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endpoint")]
    pub endpoint: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_endpoint")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub endpoint_ext: Vec<Option<FieldExtension>>,
    /** **The selected instance**

 Identity and locating information of the selected DICOM SOP instances.

 SOP Instance component identify the instance selected, along with the study and series identities to form the DICOM identity hierarchy. */
    #[serde(rename = "instance")]
    pub instance: Vec<Option<ImagingManifestStudySeriesInstance>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_instance")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub instance_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ImagingManifestStudySeries {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImagingManifestStudySeriesBuilder {
        ImagingManifestStudySeriesBuilder::default()
    }
}
/// Sub-fields of the instance field in ImagingManifestStudySeries
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImagingManifestStudySeriesInstanceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImagingManifestStudySeriesInstance {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **SOP class UID of instance**

 SOP class UID of the selected instance.

 SOP class UID identifies the type of the selected instances, e.g. CT image, Gray scale softcopy presentation state, ECG waveform, etc. */
    #[serde(rename = "sopClass")]
    pub sop_class: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sopClass")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sop_class_ext: Option<FieldExtension>,
    /** **Selected instance UID**

 SOP Instance UID of the selected instance.

 SOP instance UID identifies the instance. */
    #[serde(rename = "uid")]
    pub uid: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_uid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub uid_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ImagingManifestStudySeriesInstance {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImagingManifestStudySeriesInstanceBuilder {
        ImagingManifestStudySeriesInstanceBuilder::default()
    }
}
/** Base StructureDefinition for ImagingStudy Resource

 **[ImagingStudy](http://hl7.org/fhir/StructureDefinition/ImagingStudy) v3.0.2**

 A set of images produced in single study (one or more series of references images)

 Representation of the content produced in a DICOM imaging study. A study comprises a set of series, each of which includes a set of Service-Object Pair Instances (SOP Instances - images or other data) acquired or produced in a common context.  A series is of only one modality (e.g. X-ray, CT, MR, ultrasound), but a study may have multiple series of different modalities.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ImagingStudy(pub Box<ImagingStudyInner>);
/** Base StructureDefinition for ImagingStudy Resource

 **[ImagingStudy](http://hl7.org/fhir/StructureDefinition/ImagingStudy) v3.0.2**

 A set of images produced in single study (one or more series of references images)

 Representation of the content produced in a DICOM imaging study. A study comprises a set of series, each of which includes a set of Service-Object Pair Instances (SOP Instances - images or other data) acquired or produced in a common context.  A series is of only one modality (e.g. X-ray, CT, MR, ultrasound), but a study may have multiple series of different modalities.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImagingStudyBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ImagingStudyInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ImagingStudy::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ImagingStudy", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Formal DICOM identifier for the study**

 Formal identifier for the study.

 */
    #[serde(rename = "uid")]
    pub uid: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_uid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub uid_ext: Option<FieldExtension>,
    /** **Related workflow identifier ("Accession Number")**

 Accession Number is an identifier related to some aspect of imaging workflow and data management. Usage may vary across different institutions.  See for instance [IHE Radiology Technical Framework Volume 1 Appendix A](http://www.ihe.net/uploadedFiles/Documents/Radiology/IHE_RAD_TF_Rev13.0_Vol1_FT_2014-07-30.pdf).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "accession")]
    pub accession: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_accession")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub accession_ext: Option<FieldExtension>,
    /** **Other identifiers for the study**

 Other identifiers for the study.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[InstanceAvailability](http://hl7.org/fhir/ValueSet/instance-availability); ONLINE | OFFLINE | NEARLINE | UNAVAILABLE**

 Availability of study (online, offline, or nearline).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "availability")]
    pub availability: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_availability")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub availability_ext: Option<FieldExtension>,
    /** **[ImagingModality](http://hl7.org/fhir/ValueSet/dicom-cid29); All series modality if actual acquisition modalities**

 A list of all the Series.ImageModality values that are actual acquisition modalities, i.e. those in the DICOM Context Group 29 (value set OID 1.2.840.10008.6.1.19).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modalityList")]
    pub modality_list: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_modalityList")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub modality_list_ext: Vec<Option<FieldExtension>>,
    /** **Who the images are of**

 The patient imaged in the study.

 */
    #[serde(rename = "patient")]
    pub patient: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_ext: Option<FieldExtension>,
    /** **Originating context**

 The encounter or episode at which the request is initiated.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **When the study was started**

 Date and time the study started.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "started")]
    pub started: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_started")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub started_ext: Option<FieldExtension>,
    /** **Request fulfilled**

 A list of the diagnostic requests that resulted in this imaging study being performed.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basedOn")]
    pub based_on: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_basedOn")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub based_on_ext: Vec<Option<FieldExtension>>,
    /** **Referring physician**

 The requesting/referring physician.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "referrer")]
    pub referrer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_referrer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub referrer_ext: Option<FieldExtension>,
    /** **Who interpreted images**

 Who read the study and interpreted the images or other content.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "interpreter")]
    pub interpreter: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_interpreter")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub interpreter_ext: Vec<Option<FieldExtension>>,
    /** **Study access endpoint**

 The network service providing access (e.g., query, view, or retrieval) for the study. See implementation notes for information about using DICOM endpoints. A study-level endpoint applies to each series in the study, unless overridden by a series-level endpoint with the same Endpoint.type.

 Typical endpoint types include DICOM WADO-RS, which is used to retrieve DICOM instances in native or rendered (e.g., JPG, PNG), formats using a RESTful API; DICOM WADO-URI, which can similarly retrieve native or rendered instances, except using an HTTP query-based approach; DICOM QIDO-RS, which allows RESTful query for DICOM information without retrieving the actual instances; or IHE Invoke Image Display (IID), which provides standard invocation of an imaging web viewer. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endpoint")]
    pub endpoint: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_endpoint")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub endpoint_ext: Vec<Option<FieldExtension>>,
    /** **Number of Study Related Series**

 Number of Series in the Study. This value given may be larger than the number of series elements this Resource contains due to resource availability, security, or other factors. This element should be present if any series elements are present.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "numberOfSeries")]
    pub number_of_series: Option<u32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_numberOfSeries")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub number_of_series_ext: Option<FieldExtension>,
    /** **Number of Study Related Instances**

 Number of SOP Instances in Study. This value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "numberOfInstances")]
    pub number_of_instances: Option<u32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_numberOfInstances")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub number_of_instances_ext: Option<FieldExtension>,
    /** **The performed Procedure reference**

 A reference to the performed Procedure.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "procedureReference")]
    pub procedure_reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_procedureReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub procedure_reference_ext: Vec<Option<FieldExtension>>,
    /** **[ImagingProcedureCode](http://hl7.org/fhir/ValueSet/procedure-code); The performed procedure code**

 The code for the performed procedure type.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "procedureCode")]
    pub procedure_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_procedureCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub procedure_code_ext: Vec<Option<FieldExtension>>,
    /** **[ImagingReason](http://hl7.org/fhir/ValueSet/procedure-reason); Why the study was requested**

 Description of clinical condition indicating why the ImagingStudy was requested.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reason_ext: Option<FieldExtension>,
    /** **Institution-generated description**

 Institution-generated description or classification of the Study performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Each study has one or more series of instances**

 Each study has one or more series of images or other content.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "series")]
    pub series: Vec<Option<ImagingStudySeries>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_series")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub series_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ImagingStudyBuilder {
    #[doc = concat!("Finalize building ", "ImagingStudy", ".")]
    pub fn build(self) -> Result<ImagingStudy, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ImagingStudyInner> for ImagingStudy {
    fn from(inner: ImagingStudyInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ImagingStudy {
    type Target = ImagingStudyInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ImagingStudy {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ImagingStudy {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ImagingStudyBuilder {
        ImagingStudyBuilder::default()
    }
}
impl ImagingStudy {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ImagingStudy
    }
}
/// Sub-fields of the series field in ImagingStudy
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImagingStudySeriesBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImagingStudySeries {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Formal DICOM identifier for this series**

 Formal identifier for this series.

 */
    #[serde(rename = "uid")]
    pub uid: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_uid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub uid_ext: Option<FieldExtension>,
    /** **Numeric identifier of this series**

 The numeric identifier of this series in the study.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "number")]
    pub number: Option<u32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_number")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub number_ext: Option<FieldExtension>,
    /** **[ImagingModality](http://hl7.org/fhir/ValueSet/dicom-cid29); The modality of the instances in the series**

 The modality of this series sequence.

 */
    #[serde(rename = "modality")]
    pub modality: Coding,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_modality")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub modality_ext: Option<FieldExtension>,
    /** **A short human readable summary of the series**

 A description of the series.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Number of Series Related Instances**

 Number of SOP Instances in the Study. The value given may be larger than the number of instance elements this resource contains due to resource availability, security, or other factors. This element should be present if any instance elements are present.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "numberOfInstances")]
    pub number_of_instances: Option<u32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_numberOfInstances")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub number_of_instances_ext: Option<FieldExtension>,
    /** **[InstanceAvailability](http://hl7.org/fhir/ValueSet/instance-availability); ONLINE | OFFLINE | NEARLINE | UNAVAILABLE**

 Availability of series (online, offline or nearline).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "availability")]
    pub availability: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_availability")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub availability_ext: Option<FieldExtension>,
    /** **Series access endpoint**

 The network service providing access (e.g., query, view, or retrieval) for this series. See implementation notes for information about using DICOM endpoints. A series-level endpoint, if present, has precedence over a study-level endpoint with the same Endpoint.type.

 Typical endpoint types include DICOM WADO-RS, which is used to retrieve DICOM instances in native or rendered (e.g., JPG, PNG) formats using a RESTful API; DICOM WADO-URI, which can similarly retrieve native or rendered instances, except using an HTTP query-based approach; and DICOM QIDO-RS, which allows RESTful query for DICOM information without retrieving the actual instances. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endpoint")]
    pub endpoint: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_endpoint")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub endpoint_ext: Vec<Option<FieldExtension>>,
    /** **[BodySite](http://hl7.org/fhir/ValueSet/body-site); Body part examined**

 The anatomic structures examined. See DICOM Part 16 Annex L (http://dicom.nema.org/medical/dicom/current/output/chtml/part16/chapter_L.html) for DICOM to SNOMED-CT mappings. The bodySite may indicate the laterality of body part imaged; if so, it shall be consistent with any content of ImagingStudy.series.laterality.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "bodySite")]
    pub body_site: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_bodySite")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub body_site_ext: Option<FieldExtension>,
    /** **[Laterality](http://hl7.org/fhir/ValueSet/bodysite-laterality); Body part laterality**

 The laterality of the (possibly paired) anatomic structures examined. E.g., the left knee, both lungs, or unpaired abdomen. If present, shall be consistent with any laterality information indicated in ImagingStudy.series.bodySite.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "laterality")]
    pub laterality: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_laterality")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub laterality_ext: Option<FieldExtension>,
    /** **When the series started**

 The date and time the series was started.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "started")]
    pub started: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_started")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub started_ext: Option<FieldExtension>,
    /** **Who performed the series**

 The physician or operator (often the radiology technician)  who performed the series. The performer is recorded at the series level, since each series in a study may be performed by a different practitioner, at different times, and using different devices. A series may be performed by multiple practitioners.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_performer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub performer_ext: Vec<Option<FieldExtension>>,
    /** **A single SOP instance from the series**

 A single SOP instance within the series, e.g. an image, or presentation state.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instance")]
    pub instance: Vec<Option<ImagingStudySeriesInstance>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_instance")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub instance_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ImagingStudySeries {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImagingStudySeriesBuilder {
        ImagingStudySeriesBuilder::default()
    }
}
/// Sub-fields of the instance field in ImagingStudySeries
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImagingStudySeriesInstanceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImagingStudySeriesInstance {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Formal DICOM identifier for this instance**

 Formal identifier for this image or other content.

 */
    #[serde(rename = "uid")]
    pub uid: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_uid")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub uid_ext: Option<FieldExtension>,
    /** **The number of this instance in the series**

 The number of instance in the series.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "number")]
    pub number: Option<u32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_number")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub number_ext: Option<FieldExtension>,
    /** **DICOM class type**

 DICOM instance  type.

 */
    #[serde(rename = "sopClass")]
    pub sop_class: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sopClass")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sop_class_ext: Option<FieldExtension>,
    /** **Description of instance**

 The description of the instance.

 Particularly for post-acquisition analytic objects, such as SR, presentation states, value mapping, etc. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ImagingStudySeriesInstance {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImagingStudySeriesInstanceBuilder {
        ImagingStudySeriesInstanceBuilder::default()
    }
}
/** Base StructureDefinition for Immunization Resource

 **[Immunization](http://hl7.org/fhir/StructureDefinition/Immunization) v3.0.2**

 Immunization event information

 Describes the event of a patient being administered a vaccination or a record of a vaccination as reported by a patient, a clinician or another party and may include vaccine reaction information and what vaccination protocol was followed.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Immunization(pub Box<ImmunizationInner>);
/** Base StructureDefinition for Immunization Resource

 **[Immunization](http://hl7.org/fhir/StructureDefinition/Immunization) v3.0.2**

 Immunization event information

 Describes the event of a patient being administered a vaccination or a record of a vaccination as reported by a patient, a clinician or another party and may include vaccine reaction information and what vaccination protocol was followed.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImmunizationBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ImmunizationInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Immunization::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Immunization", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business identifier**

 A unique identifier assigned to this immunization record.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[ImmunizationStatus](http://hl7.org/fhir/ValueSet/immunization-status); completed | entered-in-error**

 Indicates the current status of the vaccination event.

 Will generally be set to show that the immunization has been completed.

This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(rename = "status")]
    pub status: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **Flag for whether immunization was given**

 Indicates if the vaccination was or was not given.

 This element is labeled as a modifier because it indicates that an immunization didn't happen. */
    #[serde(rename = "notGiven")]
    pub not_given: bool,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_notGiven")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub not_given_ext: Option<FieldExtension>,
    /** **[VaccineCode](http://hl7.org/fhir/ValueSet/vaccine-code); Vaccine product administered**

 Vaccine that was administered or was to be administered.

 */
    #[serde(rename = "vaccineCode")]
    pub vaccine_code: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_vaccineCode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub vaccine_code_ext: Option<FieldExtension>,
    /** **Who was immunized**

 The patient who either received or did not receive the immunization.

 */
    #[serde(rename = "patient")]
    pub patient: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_ext: Option<FieldExtension>,
    /** **Encounter administered as part of**

 The visit or admission or other contact between patient and health care provider the immunization was performed as part of.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "encounter")]
    pub encounter: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_encounter")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub encounter_ext: Option<FieldExtension>,
    /** **Vaccination administration date**

 Date vaccine administered or was to be administered.

 When immunizations are given a specific date and time should always be known.   When immunizations are patient reported, a specific date might not be known.  Although partial dates are allowed, an adult patient might not be able to recall the year a childhood immunization was given. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Indicates context the data was recorded in**

 An indication that the content of the record is based on information from the person who administered the vaccine. This reflects the context under which the data was originally recorded.

 Reflects the “reliability” of the content. */
    #[serde(rename = "primarySource")]
    pub primary_source: bool,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_primarySource")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub primary_source_ext: Option<FieldExtension>,
    /** **[ImmunizationReportOrigin](http://hl7.org/fhir/ValueSet/immunization-origin); Indicates the source of a secondarily reported record**

 The source of the data when the report of the immunization event is not based on information from the person who administered the vaccine.

 Should not be populated if primarySource = True, will not be required even if primarySource = False. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reportOrigin")]
    pub report_origin: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reportOrigin")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub report_origin_ext: Option<FieldExtension>,
    /** **Where vaccination occurred**

 The service delivery location where the vaccine administration occurred.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "location")]
    pub location: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_location")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub location_ext: Option<FieldExtension>,
    /** **Vaccine manufacturer**

 Name of vaccine manufacturer.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "manufacturer")]
    pub manufacturer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_manufacturer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub manufacturer_ext: Option<FieldExtension>,
    /** **Vaccine lot number**

 Lot number of the  vaccine product.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "lotNumber")]
    pub lot_number: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_lotNumber")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub lot_number_ext: Option<FieldExtension>,
    /** **Vaccine expiration date**

 Date vaccine batch expires.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "expirationDate")]
    pub expiration_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_expirationDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub expiration_date_ext: Option<FieldExtension>,
    /** **[ImmunizationSite](http://hl7.org/fhir/ValueSet/immunization-site); Body site vaccine  was administered**

 Body site where vaccine was administered.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "site")]
    pub site: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_site")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub site_ext: Option<FieldExtension>,
    /** **[ImmunizationRoute](http://hl7.org/fhir/ValueSet/immunization-route); How vaccine entered body**

 The path by which the vaccine product is taken into the body.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "route")]
    pub route: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_route")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub route_ext: Option<FieldExtension>,
    /** **Amount of vaccine administered**

 The quantity of vaccine product that was administered.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "doseQuantity")]
    pub dose_quantity: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_doseQuantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub dose_quantity_ext: Option<FieldExtension>,
    /** **Who performed event**

 Indicates who or what performed the event.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "practitioner")]
    pub practitioner: Vec<Option<ImmunizationPractitioner>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_practitioner")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub practitioner_ext: Vec<Option<FieldExtension>>,
    /** **Vaccination notes**

 Extra information about the immunization that is not conveyed by the other attributes.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
    /** **Administration/non-administration reasons**

 Reasons why a vaccine was or was not administered.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "explanation")]
    pub explanation: Option<ImmunizationExplanation>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_explanation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub explanation_ext: Option<FieldExtension>,
    /** **Details of a reaction that follows immunization**

 Categorical data indicating that an adverse event is associated in time to an immunization.

 A reaction may be an indication of an allergy or intolerance and, if this is determined to be the case,  it should be recorded as a new [AllergyIntolerance](allergyintolerance.html) resource instance as most systems will not query against  past Immunization.reaction elements. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reaction")]
    pub reaction: Vec<Option<ImmunizationReaction>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reaction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reaction_ext: Vec<Option<FieldExtension>>,
    /** **What protocol was followed**

 Contains information about the protocol(s) under which the vaccine was administered.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "vaccinationProtocol")]
    pub vaccination_protocol: Vec<Option<ImmunizationVaccinationProtocol>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_vaccinationProtocol")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub vaccination_protocol_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ImmunizationBuilder {
    #[doc = concat!("Finalize building ", "Immunization", ".")]
    pub fn build(self) -> Result<Immunization, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ImmunizationInner> for Immunization {
    fn from(inner: ImmunizationInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Immunization {
    type Target = ImmunizationInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Immunization {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Immunization {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ImmunizationBuilder {
        ImmunizationBuilder::default()
    }
}
impl Immunization {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Immunization
    }
}
/// Sub-fields of the practitioner field in Immunization
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImmunizationPractitionerBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImmunizationPractitioner {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ImmunizationRole](http://hl7.org/fhir/ValueSet/immunization-role); What type of performance was done**

 Describes the type of performance (e.g. ordering provider, administering provider, etc.).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "role")]
    pub role: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_role")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub role_ext: Option<FieldExtension>,
    /** **Individual who was performing**

 The device, practitioner, etc. who performed the action.

 */
    #[serde(rename = "actor")]
    pub actor: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_actor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub actor_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ImmunizationPractitioner {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImmunizationPractitionerBuilder {
        ImmunizationPractitionerBuilder::default()
    }
}
/// Sub-fields of the explanation field in Immunization
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImmunizationExplanationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImmunizationExplanation {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ImmunizationReason](http://hl7.org/fhir/ValueSet/immunization-reason); Why immunization occurred**

 Reasons why a vaccine was administered.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reason")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_ext: Vec<Option<FieldExtension>>,
    /** **[NoImmunizationReason](http://hl7.org/fhir/ValueSet/no-immunization-reason); Why immunization did not occur**

 Reason why a vaccine was not administered.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonNotGiven")]
    pub reason_not_given: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonNotGiven")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_not_given_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ImmunizationExplanation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImmunizationExplanationBuilder {
        ImmunizationExplanationBuilder::default()
    }
}
/// Sub-fields of the reaction field in Immunization
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImmunizationReactionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImmunizationReaction {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **When reaction started**

 Date of reaction to the immunization.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Additional information on reaction**

 Details of the reaction.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "detail")]
    pub detail: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_detail")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub detail_ext: Option<FieldExtension>,
    /** **Indicates self-reported reaction**

 Self-reported indicator.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reported")]
    pub reported: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reported")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reported_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ImmunizationReaction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImmunizationReactionBuilder {
        ImmunizationReactionBuilder::default()
    }
}
/// Sub-fields of the vaccinationProtocol field in Immunization
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImmunizationVaccinationProtocolBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImmunizationVaccinationProtocol {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Dose number within series**

 Nominal position in a series.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "doseSequence")]
    pub dose_sequence: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_doseSequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub dose_sequence_ext: Option<FieldExtension>,
    /** **Details of vaccine protocol**

 Contains the description about the protocol under which the vaccine was administered.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Who is responsible for protocol**

 Indicates the authority who published the protocol.  E.g. ACIP.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authority")]
    pub authority: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_authority")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub authority_ext: Option<FieldExtension>,
    /** **Name of vaccine series**

 One possible path to achieve presumed immunity against a disease - within the context of an authority.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "series")]
    pub series: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_series")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub series_ext: Option<FieldExtension>,
    /** **Recommended number of doses for immunity**

 The recommended number of doses to achieve immunity.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "seriesDoses")]
    pub series_doses: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_seriesDoses")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub series_doses_ext: Option<FieldExtension>,
    /** **[VaccinationProtocoltargetDisease](http://hl7.org/fhir/ValueSet/vaccination-protocol-dose-target); Disease immunized against**

 The targeted disease.

 */
    #[serde(rename = "targetDisease")]
    pub target_disease: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_targetDisease")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub target_disease_ext: Vec<Option<FieldExtension>>,
    /** **[VaccinationProtocolDoseStatus](http://hl7.org/fhir/ValueSet/vaccination-protocol-dose-status); Indicates if dose counts towards immunity**

 Indicates if the immunization event should "count" against  the protocol.

 May need to differentiate between status declarations by a provider vs. a CDS engine. */
    #[serde(rename = "doseStatus")]
    pub dose_status: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_doseStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub dose_status_ext: Option<FieldExtension>,
    /** **[VaccinationProtocolDoseStatusReason](http://hl7.org/fhir/ValueSet/vaccination-protocol-dose-status-reason); Why dose does (not) count**

 Provides an explanation as to why an immunization event should or should not count against the protocol.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "doseStatusReason")]
    pub dose_status_reason: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_doseStatusReason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub dose_status_reason_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ImmunizationVaccinationProtocol {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImmunizationVaccinationProtocolBuilder {
        ImmunizationVaccinationProtocolBuilder::default()
    }
}
/** Base StructureDefinition for ImmunizationRecommendation Resource

 **[ImmunizationRecommendation](http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation) v3.0.2**

 Guidance or advice relating to an immunization

 A patient's point-in-time immunization and recommendation (i.e. forecasting a patient's immunization eligibility according to a published schedule) with optional supporting justification.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ImmunizationRecommendation(pub Box<ImmunizationRecommendationInner>);
/** Base StructureDefinition for ImmunizationRecommendation Resource

 **[ImmunizationRecommendation](http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation) v3.0.2**

 Guidance or advice relating to an immunization

 A patient's point-in-time immunization and recommendation (i.e. forecasting a patient's immunization eligibility according to a published schedule) with optional supporting justification.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImmunizationRecommendationBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ImmunizationRecommendationInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ImmunizationRecommendation::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ImmunizationRecommendation", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business identifier**

 A unique identifier assigned to this particular recommendation record.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Who this profile is for**

 The patient the recommendations are for.

 */
    #[serde(rename = "patient")]
    pub patient: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_ext: Option<FieldExtension>,
    /** **Vaccine administration recommendations**

 Vaccine administration recommendations.

 */
    #[serde(rename = "recommendation")]
    pub recommendation: Vec<Option<ImmunizationRecommendationRecommendation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_recommendation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub recommendation_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ImmunizationRecommendationBuilder {
    #[doc = concat!("Finalize building ", "ImmunizationRecommendation", ".")]
    pub fn build(
        self,
    ) -> Result<ImmunizationRecommendation, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ImmunizationRecommendationInner> for ImmunizationRecommendation {
    fn from(inner: ImmunizationRecommendationInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ImmunizationRecommendation {
    type Target = ImmunizationRecommendationInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ImmunizationRecommendation {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ImmunizationRecommendation {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ImmunizationRecommendationBuilder {
        ImmunizationRecommendationBuilder::default()
    }
}
impl ImmunizationRecommendation {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ImmunizationRecommendation
    }
}
/// Sub-fields of the recommendation field in ImmunizationRecommendation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImmunizationRecommendationRecommendationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImmunizationRecommendationRecommendation {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Date recommendation created**

 The date the immunization recommendation was created.

 */
    #[serde(rename = "date")]
    pub date: DateTime,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **[VaccineCode](http://hl7.org/fhir/ValueSet/vaccine-code); Vaccine recommendation applies to**

 Vaccine that pertains to the recommendation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "vaccineCode")]
    pub vaccine_code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_vaccineCode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub vaccine_code_ext: Option<FieldExtension>,
    /** **[TargetDisease](http://hl7.org/fhir/ValueSet/immunization-recommendation-target-disease); Disease to be immunized against**

 The targeted disease for the recommendation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "targetDisease")]
    pub target_disease: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_targetDisease")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub target_disease_ext: Option<FieldExtension>,
    /** **Recommended dose number**

 The next recommended dose number (e.g. dose 2 is the next recommended dose).

 May need other dose concepts such as administered vs. valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "doseNumber")]
    pub dose_number: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_doseNumber")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub dose_number_ext: Option<FieldExtension>,
    /** **[ImmunizationRecommendationStatus](http://hl7.org/fhir/ValueSet/immunization-recommendation-status); Vaccine administration status**

 Vaccine administration status.

 */
    #[serde(rename = "forecastStatus")]
    pub forecast_status: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_forecastStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub forecast_status_ext: Option<FieldExtension>,
    /** **Dates governing proposed immunization**

 Vaccine date recommendations.  For example, earliest date to administer, latest date to administer, etc.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dateCriterion")]
    pub date_criterion: Vec<
        Option<ImmunizationRecommendationRecommendationDateCriterion>,
    >,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_dateCriterion")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub date_criterion_ext: Vec<Option<FieldExtension>>,
    /** **Protocol used by recommendation**

 Contains information about the protocol under which the vaccine was administered.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "protocol")]
    pub protocol: Option<ImmunizationRecommendationRecommendationProtocol>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_protocol")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub protocol_ext: Option<FieldExtension>,
    /** **Past immunizations supporting recommendation**

 Immunization event history that supports the status and recommendation.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "supportingImmunization")]
    pub supporting_immunization: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_supportingImmunization")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub supporting_immunization_ext: Vec<Option<FieldExtension>>,
    /** **Patient observations supporting recommendation**

 Patient Information that supports the status and recommendation.  This includes patient observations, adverse reactions and allergy/intolerance information.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "supportingPatientInformation")]
    pub supporting_patient_information: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_supportingPatientInformation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub supporting_patient_information_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ImmunizationRecommendationRecommendation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImmunizationRecommendationRecommendationBuilder {
        ImmunizationRecommendationRecommendationBuilder::default()
    }
}
/// Sub-fields of the dateCriterion field in ImmunizationRecommendationRecommendation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImmunizationRecommendationRecommendationDateCriterionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImmunizationRecommendationRecommendationDateCriterion {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ImmunizationRecommendationDateCriterion](http://hl7.org/fhir/ValueSet/immunization-recommendation-date-criterion); Type of date**

 Date classification of recommendation.  For example, earliest date to give, latest date to give, etc.

 */
    #[serde(rename = "code")]
    pub code: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Recommended date**

 The date whose meaning is specified by dateCriterion.code.

 */
    #[serde(rename = "value")]
    pub value: DateTime,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_value")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ImmunizationRecommendationRecommendationDateCriterion {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImmunizationRecommendationRecommendationDateCriterionBuilder {
        ImmunizationRecommendationRecommendationDateCriterionBuilder::default()
    }
}
/// Sub-fields of the protocol field in ImmunizationRecommendationRecommendation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImmunizationRecommendationRecommendationProtocolBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImmunizationRecommendationRecommendationProtocol {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Dose number within sequence**

 Indicates the nominal position in a series of the next dose.  This is the recommended dose number as per a specified protocol.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "doseSequence")]
    pub dose_sequence: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_doseSequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub dose_sequence_ext: Option<FieldExtension>,
    /** **Protocol details**

 Contains the description about the protocol under which the vaccine was administered.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Who is responsible for protocol**

 Indicates the authority who published the protocol.  For example, ACIP.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authority")]
    pub authority: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_authority")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub authority_ext: Option<FieldExtension>,
    /** **Name of vaccination series**

 One possible path to achieve presumed immunity against a disease - within the context of an authority.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "series")]
    pub series: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_series")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub series_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ImmunizationRecommendationRecommendationProtocol {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImmunizationRecommendationRecommendationProtocolBuilder {
        ImmunizationRecommendationRecommendationProtocolBuilder::default()
    }
}
/** Base StructureDefinition for ImplementationGuide Resource

 **[ImplementationGuide](http://hl7.org/fhir/StructureDefinition/ImplementationGuide) v3.0.2**

 A set of rules about how FHIR is used

 A set of rules of how FHIR is used to solve a particular problem. This resource is used to gather all the parts of an implementation guide into a logical whole and to publish a computable definition of all the parts.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ImplementationGuide(pub Box<ImplementationGuideInner>);
/** Base StructureDefinition for ImplementationGuide Resource

 **[ImplementationGuide](http://hl7.org/fhir/StructureDefinition/ImplementationGuide) v3.0.2**

 A set of rules about how FHIR is used

 A set of rules of how FHIR is used to solve a particular problem. This resource is used to gather all the parts of an implementation guide into a logical whole and to publish a computable definition of all the parts.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImplementationGuideBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ImplementationGuideInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ImplementationGuide::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ImplementationGuide", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical URI to reference this implementation guide (globally unique)**

 An absolute URI that is used to identify this implementation guide when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this implementation guide is (or will be) published. The URL SHOULD include the major version of the implementation guide. For more information see [Technical and Business Versions](resource.html#versions).

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred.  Multiple instances may share the same url if they have a distinct version. */
    #[serde(rename = "url")]
    pub url: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Business version of the implementation guide**

 The identifier that is used to identify this version of the implementation guide when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the implementation guide author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.

 There may be different implementation guide instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a refrence to a particular business version of the implementation guide with the format [url]|[version]. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Name for this implementation guide (computer friendly)**

 A natural language name identifying the implementation guide. This name should be usable as an identifier for the module by machine processing applications such as code generation.

 The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure that it is computable friendly. */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this implementation guide. Enables tracking the life-cycle of the content.

 Allows filtering of implementation guides that are appropriate for use vs. not.
This is labeled as "Is Modifier" because applications should not use a retired implementation guide without due consideration. */
    #[serde(rename = "status")]
    pub status: codes::PublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **For testing purposes, not real usage**

 A boolean value to indicate that this implementation guide is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of implementation guide that are appropriate for use vs. not. This is labeled as "Is Modifier" because applications should not use an experimental implementation guide in production. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "experimental")]
    pub experimental: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_experimental")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub experimental_ext: Option<FieldExtension>,
    /** **Date this was last changed**

 The date  (and optionally time) when the implementation guide was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the implementation guide changes.

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the implementation guide. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Name of the publisher (organization or individual)**

 The name of the individual or organization that published the implementation guide.

 Usually an organization, but may be an individual. The publisher (or steward) of the implementation guide is the organization or individual primarily responsible for the maintenance and upkeep of the implementation guide. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the implementation guide. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisher")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_ext: Option<FieldExtension>,
    /** **Contact details for the publisher**

 Contact details to assist a user in finding and communicating with the publisher.

 May be a web site, an email address, a telephone number, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Natural language description of the implementation guide**

 A free text natural language description of the implementation guide from a consumer's perspective.

 This description can be used to capture details such as why the implementation guide was built, comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the implementation guide as conveyed in the 'text' field of the resource itself. This item SHOULD be populated unless the information is available from context (e.g. the language of the profile is presumed to be the predominant language in the place the profile was created). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Context the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate implementation guide instances.

 When multiple useContexts are specified, there is no expectation whether all or any of the contexts apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useContext")]
    pub use_context: Vec<Option<UsageContext>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_useContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_context_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Intended jurisdiction for implementation guide (if applicable)**

 A legal or geographic region in which the implementation guide is intended to be used.

 It may be possible for the implementation guide to be used in jurisdictions other than those for which it was originally designed or intended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **Use and/or publishing restrictions**

 A copyright statement relating to the implementation guide and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the implementation guide.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyright")]
    pub copyright: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyright")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_ext: Option<FieldExtension>,
    /** **FHIR Version this Implementation Guide targets**

 The version of the FHIR specification on which this ImplementationGuide is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is 3.0.2 for this version.

 An Implementation Guide should specify the target it applies to, as ImplementationGuides are rarely valid across multiple versions of FHIR. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "fhirVersion")]
    pub fhir_version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_fhirVersion")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub fhir_version_ext: Option<FieldExtension>,
    /** **Another Implementation guide this depends on**

 Another implementation guide that this implementation depends on. Typically, an implementation guide uses value sets, profiles etc.defined in other implementation guides.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dependency")]
    pub dependency: Vec<Option<ImplementationGuideDependency>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_dependency")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub dependency_ext: Vec<Option<FieldExtension>>,
    /** **Group of resources as used in .page.package**

 A logical group of resources. Logical groups can be used when building pages.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "package")]
    pub package: Vec<Option<ImplementationGuidePackage>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_package")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub package_ext: Vec<Option<FieldExtension>>,
    /** **Profiles that apply globally**

 A set of profiles that all resources covered by this implementation guide must conform to.

 See [Default Profiles](implementationguide.html#default) for a discussion of which resources are 'covered' by an implementation guide. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "global")]
    pub global: Vec<Option<ImplementationGuideGlobal>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_global")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub global_ext: Vec<Option<FieldExtension>>,
    /** **Image, css, script, etc.**

 A binary file that is included in the  implementation guide when it is published.

 This is principally included for the FHIR publishing tool, but may be useful when extracting and reusing content from the implementation guide. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "binary")]
    pub binary: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_binary")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub binary_ext: Vec<Option<FieldExtension>>,
    /** **Page/Section in the Guide**

 A page / section in the implementation guide. The root page is the implementation guide home page.

 Pages automatically become sections if they have sub-pages. By convention, the home page is called index.html. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "page")]
    pub page: Option<ImplementationGuidePage>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_page")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub page_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ImplementationGuideBuilder {
    #[doc = concat!("Finalize building ", "ImplementationGuide", ".")]
    pub fn build(self) -> Result<ImplementationGuide, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ImplementationGuideInner> for ImplementationGuide {
    fn from(inner: ImplementationGuideInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ImplementationGuide {
    type Target = ImplementationGuideInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ImplementationGuide {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ImplementationGuide {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ImplementationGuideBuilder {
        ImplementationGuideBuilder::default()
    }
}
impl ImplementationGuide {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ImplementationGuide
    }
}
/// Sub-fields of the dependency field in ImplementationGuide
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImplementationGuideDependencyBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImplementationGuideDependency {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[GuideDependencyType](http://hl7.org/fhir/ValueSet/guide-dependency-type); reference | inclusion**

 How the dependency is represented when the guide is published.

 For information about processing included guides, see [Including Guides]{implementationguide.html#include}. */
    #[serde(rename = "type")]
    pub r#type: codes::GuideDependencyType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Where to find dependency**

 Where the dependency is located.

 When a guide is published, and the type is 'include', this will be a relative reference within the guide. */
    #[serde(rename = "uri")]
    pub uri: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_uri")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub uri_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ImplementationGuideDependency {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImplementationGuideDependencyBuilder {
        ImplementationGuideDependencyBuilder::default()
    }
}
/// Sub-fields of the package field in ImplementationGuide
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImplementationGuidePackageBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImplementationGuidePackage {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Name used .page.package**

 The name for the group, as used in page.package.

 */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Human readable text describing the package**

 Human readable text describing the package.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Resource in the implementation guide**

 A resource that is part of the implementation guide. Conformance resources (value set, structure definition, capability statements etc.) are obvious candidates for inclusion, but any kind of resource can be included as an example resource.

 */
    #[serde(rename = "resource")]
    pub resource: Vec<Option<ImplementationGuidePackageResource>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_resource")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub resource_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ImplementationGuidePackage {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImplementationGuidePackageBuilder {
        ImplementationGuidePackageBuilder::default()
    }
}
/// Sub-fields of the resource field in ImplementationGuidePackage
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImplementationGuidePackageResourceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImplementationGuidePackageResource {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **If not an example, has its normal meaning**

 Whether a resource is included in the guide as part of the rules defined by the guide, or just as an example of a resource that conforms to the rules and/or help implementers understand the intent of the guide.

 Typically, conformance resources and knowledge resources are directly part of the implementation guide, with their normal meaning, and patient linked resources are usually examples. However this is not always true. */
    #[serde(rename = "example")]
    pub example: bool,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_example")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub example_ext: Option<FieldExtension>,
    /** **Human Name for the resource**

 A human assigned name for the resource. All resources SHOULD have a name, but the name may be extracted from the resource (e.g. ValueSet.name).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Reason why included in guide**

 A description of the reason that a resource has been included in the implementation guide.

 This is mostly used with examples to explain why it is present (though they can have extensive comments in the examples). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Short code to identify the resource**

 A short code that may be used to identify the resource throughout the implementation guide.

 This is used when generating schematrons from profiles, for example, but has other uses. Publishing tooling may autogenerate this value, but a human assigned value is more useful. This value must be unique within an implementation guide (across included guides as well). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "acronym")]
    pub acronym: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_acronym")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub acronym_ext: Option<FieldExtension>,
    /** **Location of the resource**

 Where this resource is found.

 Usually this is a relative URL that locates the resource within the implementation guide. If you authoring an implementation guide, and will publish it using the FHIR publication tooling, use a URI that may point to a resource, or to one of various alternative representations (e.g. spreadsheet). The tooling will convert this when it publishes it. */
    #[serde(flatten)]
    pub source: ImplementationGuidePackageResourceSource,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_ext: Option<ImplementationGuidePackageResourceSourceExtension>,
    /** **Resource this is an example of (if applicable)**

 Another resource that this resource is an example for. This is mostly used for resources that are included as examples of StructureDefinitions.

 Examples:
* StructureDefinition -> Any
* ValueSet -> expansion
* OperationDefinition -> Parameters
* Questionnaire -> QuestionnaireResponse. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "exampleFor")]
    pub example_for: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_exampleFor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub example_for_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ImplementationGuidePackageResource {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImplementationGuidePackageResourceBuilder {
        ImplementationGuidePackageResourceBuilder::default()
    }
}
/// Choice of types for the source[x] field in ImplementationGuidePackageResource
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ImplementationGuidePackageResourceSource {
    /// Variant accepting the Uri type.
    #[serde(rename = "sourceUri")]
    Uri(String),
    /// Variant accepting the Reference type.
    #[serde(rename = "sourceReference")]
    Reference(Reference),
}
/// Extension value for ImplementationGuidePackageResourceSource.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ImplementationGuidePackageResourceSourceExtension {
    /// Variant accepting the Uri extension.
    #[serde(rename = "_sourceUri")]
    Uri(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_sourceReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the global field in ImplementationGuide
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImplementationGuideGlobalBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImplementationGuideGlobal {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ResourceType](http://hl7.org/fhir/ValueSet/resource-types); Type this profiles applies to**

 The type of resource that all instances must conform to.

 The type must match that of the profile that is referred to, but is made explicit here as a denormalization so that a system processing the implementation guide resource knows which resources the profile applies to even if the profile itself is not available. */
    #[serde(rename = "type")]
    pub r#type: codes::ResourceType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Profile that all resources must conform to**

 A reference to the profile that all instances must conform to.

 */
    #[serde(rename = "profile")]
    pub profile: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_profile")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub profile_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ImplementationGuideGlobal {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImplementationGuideGlobalBuilder {
        ImplementationGuideGlobalBuilder::default()
    }
}
/// Sub-fields of the page field in ImplementationGuide
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ImplementationGuidePageBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ImplementationGuidePage {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Where to find that page**

 The source address for the page.

 The publishing tool will autogenerate source for list (source = n/a), and inject included implementations for include (source = uri of guide to include). */
    #[serde(rename = "source")]
    pub source: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_source")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_ext: Option<FieldExtension>,
    /** **Short title shown for navigational assistance**

 A short title used to represent this page in navigational structures such as table of contents, bread crumbs, etc.

 */
    #[serde(rename = "title")]
    pub title: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **[GuidePageKind](http://hl7.org/fhir/ValueSet/guide-page-kind); page | example | list | include | directory | dictionary | toc | resource**

 The kind of page that this is. Some pages are autogenerated (list, example), and other kinds are of interest so that tools can navigate the user to the page of interest.

 */
    #[serde(rename = "kind")]
    pub kind: codes::GuidePageKind,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_kind")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub kind_ext: Option<FieldExtension>,
    /** **[ResourceType](http://hl7.org/fhir/ValueSet/resource-types); Kind of resource to include in the list**

 For constructed pages, what kind of resources to include in the list.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Vec<Option<codes::ResourceType>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub r#type_ext: Vec<Option<FieldExtension>>,
    /** **Name of package to include**

 For constructed pages, a list of packages to include in the page (or else empty for everything).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "package")]
    pub package: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_package")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub package_ext: Vec<Option<FieldExtension>>,
    /** **[MimeType](http://www.rfc-editor.org/bcp/bcp13.txt); Format of the page (e.g. html, markdown, etc.)**

 The format of the page.

 This is primarily for the publishing tool, that will convert all pages to html format. HTML pages are pre-processed, see xxxx. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "format")]
    pub format: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_format")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub format_ext: Option<FieldExtension>,
    /** **Nested Pages / Sections**

 Nested Pages/Sections under this page.

 The implementation guide breadcrumbs are generated from this structure. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "page")]
    pub page: Vec<Option<ImplementationGuidePage>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_page")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub page_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ImplementationGuidePage {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ImplementationGuidePageBuilder {
        ImplementationGuidePageBuilder::default()
    }
}
/** Base StructureDefinition for Library Resource

 **[Library](http://hl7.org/fhir/StructureDefinition/Library) v3.0.2**

 Represents a library of quality improvement components

 The Library resource is a general-purpose container for knowledge asset definitions. It can be used to describe and expose existing knowledge assets such as logic libraries and information model descriptions, as well as to describe a collection of knowledge assets.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Library(pub Box<LibraryInner>);
/** Base StructureDefinition for Library Resource

 **[Library](http://hl7.org/fhir/StructureDefinition/Library) v3.0.2**

 Represents a library of quality improvement components

 The Library resource is a general-purpose container for knowledge asset definitions. It can be used to describe and expose existing knowledge assets such as logic libraries and information model descriptions, as well as to describe a collection of knowledge assets.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "LibraryBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct LibraryInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Library::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Library", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical URI to reference this library (globally unique)**

 An absolute URI that is used to identify this library when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this library is (or will be) published. The URL SHOULD include the major version of the library. For more information see [Technical and Business Versions](resource.html#versions).

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred.  Multiple instances may share the same url if they have a distinct version. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "url")]
    pub url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Additional identifier for the library**

 A formal identifier that is used to identify this library when it is represented in other formats, or referenced in a specification, model, design or an instance. e.g. CMS or NQF identifiers for a measure artifact. Note that at least one identifier is required for non-experimental active artifacts.

 Typically, this is used for identifiers that can go in an HL7 V3 II (instance identifier) data type, e.g., to identify this library outside of FHIR, where it is not possible to use the logical URI. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Business version of the library**

 The identifier that is used to identify this version of the library when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the library author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge assets, refer to the Decision Support Service specification. Note that a version is required for non-experimental active artifacts.

 There may be different library instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a refrence to a particular business version of the library with the format [url]|[version]. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Name for this library (computer friendly)**

 A natural language name identifying the library. This name should be usable as an identifier for the module by machine processing applications such as code generation.

 The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure that it is computable friendly. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Name for this library (human friendly)**

 A short, descriptive, user-friendly title for the library.

 This name does not need to be machine-processing friendly and may contain punctuation, white-space, etc. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this library. Enables tracking the life-cycle of the content.

 Allows filtering of librarys that are appropriate for use vs. not.
This is labeled as "Is Modifier" because applications should not use a retired library without due consideration. */
    #[serde(rename = "status")]
    pub status: codes::PublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **For testing purposes, not real usage**

 A boolean value to indicate that this library is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of library that are appropriate for use vs. not. This is labeled as "Is Modifier" because applications should not use an experimental library in production. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "experimental")]
    pub experimental: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_experimental")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub experimental_ext: Option<FieldExtension>,
    /** **[LibraryType](http://hl7.org/fhir/ValueSet/library-type); logic-library | model-definition | asset-collection | module-definition**

 Identifies the type of library such as a Logic Library, Model Definition, Asset Collection, or Module Definition.

 */
    #[serde(rename = "type")]
    pub r#type: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Date this was last changed**

 The date  (and optionally time) when the library was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the library changes.

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the library. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Name of the publisher (organization or individual)**

 The name of the individual or organization that published the library.

 Usually an organization, but may be an individual. The publisher (or steward) of the library is the organization or individual primarily responsible for the maintenance and upkeep of the library. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the library. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisher")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_ext: Option<FieldExtension>,
    /** **Natural language description of the library**

 A free text natural language description of the library from a consumer's perspective.

 This description can be used to capture details such as why the library was built, comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the library as conveyed in the 'text' field of the resource itself. This item SHOULD be populated unless the information is available from context (e.g. the language of the profile is presumed to be the predominant language in the place the profile was created). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Why this library is defined**

 Explaination of why this library is needed and why it has been designed as it has.

 This element does not describe the usage of the library Instead  it provides traceability of ''why'' the resource is either needed or ''why'' it is defined as it is.  This may be used to point to source materials or specifications that drove the structure of this library. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purpose")]
    pub purpose: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_purpose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub purpose_ext: Option<FieldExtension>,
    /** **Describes the clinical usage of the library**

 A detailed description of how the library is used from a clinical perspective.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "usage")]
    pub usage: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_usage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub usage_ext: Option<FieldExtension>,
    /** **When the library was approved by publisher**

 The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.

 The 'date' element may be more recent than the approval date because of minor changes / editorial corrections. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "approvalDate")]
    pub approval_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_approvalDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub approval_date_ext: Option<FieldExtension>,
    /** **When the library was last reviewed**

 The date on which the resource content was last reviewed. Review happens periodically after approval, but doesn't change the original approval date.

 If specified, this is usually after the approval date. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "lastReviewDate")]
    pub last_review_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_lastReviewDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub last_review_date_ext: Option<FieldExtension>,
    /** **When the library is expected to be used**

 The period during which the library content was or is planned to be in active use.

 The effective period for a library  determines when the content is applicable for usage and is independent of publication and review dates. For example, a measure intended to be used for the year 2016 might be published in 2015. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "effectivePeriod")]
    pub effective_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_effectivePeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub effective_period_ext: Option<FieldExtension>,
    /** **Context the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate library instances.

 When multiple useContexts are specified, there is no expectation whether all or any of the contexts apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useContext")]
    pub use_context: Vec<Option<UsageContext>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_useContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_context_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Intended jurisdiction for library (if applicable)**

 A legal or geographic region in which the library is intended to be used.

 It may be possible for the library to be used in jurisdictions other than those for which it was originally designed or intended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **[DefinitionTopic](http://hl7.org/fhir/ValueSet/definition-topic); E.g. Education, Treatment, Assessment, etc**

 Descriptive topics related to the content of the library. Topics provide a high-level categorization of the library that can be useful for filtering and searching.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "topic")]
    pub topic: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_topic")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub topic_ext: Vec<Option<FieldExtension>>,
    /** **A content contributor**

 A contributor to the content of the library, including authors, editors, reviewers, and endorsers.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contributor")]
    pub contributor: Vec<Option<Contributor>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contributor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contributor_ext: Vec<Option<FieldExtension>>,
    /** **Contact details for the publisher**

 Contact details to assist a user in finding and communicating with the publisher.

 May be a web site, an email address, a telephone number, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Use and/or publishing restrictions**

 A copyright statement relating to the library and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the library.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyright")]
    pub copyright: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyright")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_ext: Option<FieldExtension>,
    /** **Additional documentation, citations, etc.**

 Related artifacts such as additional documentation, justification, or bibliographic references.

 Each related artifact is either an attachment, or a reference to another resource, but not both. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relatedArtifact")]
    pub related_artifact: Vec<Option<RelatedArtifact>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_relatedArtifact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub related_artifact_ext: Vec<Option<FieldExtension>>,
    /** **Parameters defined by the library**

 The parameter element defines parameters used by the library.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parameter")]
    pub parameter: Vec<Option<ParameterDefinition>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_parameter")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub parameter_ext: Vec<Option<FieldExtension>>,
    /** **What data is referenced by this library**

 Describes a set of data that must be provided in order to be able to successfully perform the computations defined by the library.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dataRequirement")]
    pub data_requirement: Vec<Option<DataRequirement>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_dataRequirement")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub data_requirement_ext: Vec<Option<FieldExtension>>,
    /** **Contents of the library, either embedded or referenced**

 The content of the library as an Attachment. The content may be a reference to a url, or may be directly embedded as a base-64 string. Either way, the contentType of the attachment determines how to interpret the content.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "content")]
    pub content: Vec<Option<Attachment>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_content")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub content_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl LibraryBuilder {
    #[doc = concat!("Finalize building ", "Library", ".")]
    pub fn build(self) -> Result<Library, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<LibraryInner> for Library {
    fn from(inner: LibraryInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Library {
    type Target = LibraryInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Library {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Library {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> LibraryBuilder {
        LibraryBuilder::default()
    }
}
impl Library {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Library
    }
}
/** Base StructureDefinition for Linkage Resource

 **[Linkage](http://hl7.org/fhir/StructureDefinition/Linkage) v3.0.2**

 Links records for 'same' item

 Identifies two or more records (resource instances) that are referring to the same real-world "occurrence".

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Linkage(pub Box<LinkageInner>);
/** Base StructureDefinition for Linkage Resource

 **[Linkage](http://hl7.org/fhir/StructureDefinition/Linkage) v3.0.2**

 Links records for 'same' item

 Identifies two or more records (resource instances) that are referring to the same real-world "occurrence".

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "LinkageBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct LinkageInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Linkage::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Linkage", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Whether this linkage assertion is active or not**

 Indicates whether the asserted set of linkages are considered to be "in effect".

 If false, any asserted linkages should not be considered current/relevant/applicable. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "active")]
    pub active: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_active")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub active_ext: Option<FieldExtension>,
    /** **Who is responsible for linkages**

 Identifies the user or organization responsible for asserting the linkages and who establishes the context for evaluating the nature of each linkage.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_author")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub author_ext: Option<FieldExtension>,
    /** **Item to be linked**

 Identifies one of the records that is considered to refer to the same real-world occurrence as well as how the items hould be evaluated within the collection of linked items.

 */
    #[serde(rename = "item")]
    pub item: Vec<Option<LinkageItem>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_item")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub item_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl LinkageBuilder {
    #[doc = concat!("Finalize building ", "Linkage", ".")]
    pub fn build(self) -> Result<Linkage, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<LinkageInner> for Linkage {
    fn from(inner: LinkageInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Linkage {
    type Target = LinkageInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Linkage {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Linkage {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> LinkageBuilder {
        LinkageBuilder::default()
    }
}
impl Linkage {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Linkage
    }
}
/// Sub-fields of the item field in Linkage
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "LinkageItemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct LinkageItem {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[LinkageType](http://hl7.org/fhir/ValueSet/linkage-type); source | alternate | historical**

 Distinguishes which item is "source of truth" (if any) and which items are no longer considered to be current representations.

 */
    #[serde(rename = "type")]
    pub r#type: codes::LinkageType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Resource being linked**

 The resource instance being linked as part of the group.

 */
    #[serde(rename = "resource")]
    pub resource: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_resource")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub resource_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl LinkageItem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> LinkageItemBuilder {
        LinkageItemBuilder::default()
    }
}
/** Base StructureDefinition for List Resource

 **[List](http://hl7.org/fhir/StructureDefinition/List) v3.0.2**

 Information summarized from a list of other resources

 A set of information summarized from a list of other resources.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct List(pub Box<ListInner>);
/** Base StructureDefinition for List Resource

 **[List](http://hl7.org/fhir/StructureDefinition/List) v3.0.2**

 Information summarized from a list of other resources

 A set of information summarized from a list of other resources.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ListBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ListInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "List::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::List", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business identifier**

 Identifier for the List assigned for business purposes outside the context of FHIR.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[ListStatus](http://hl7.org/fhir/ValueSet/list-status); current | retired | entered-in-error**

 Indicates the current state of this list.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::ListStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[ListMode](http://hl7.org/fhir/ValueSet/list-mode); working | snapshot | changes**

 How this list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.

 This element is labeled as a modifier because a change list must not be mis-understood as a complete list. */
    #[serde(rename = "mode")]
    pub mode: codes::ListMode,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_mode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub mode_ext: Option<FieldExtension>,
    /** **Descriptive name for the list**

 A label for the list assigned by the author.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **[ListPurpose](http://hl7.org/fhir/ValueSet/list-example-codes); What the purpose of this list is**

 This code defines the purpose of the list - why it was created.

 If there is no code, the purpose of the list is implied where it is used, such as in a document section using Document.section.code. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **If all resources have the same subject**

 The common subject (or patient) of the resources that are in the list, if there is one.

 Some purely arbitrary lists do not have a common subject, so this is optional. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Context in which list created**

 The encounter that is the context in which this list was created.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "encounter")]
    pub encounter: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_encounter")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub encounter_ext: Option<FieldExtension>,
    /** **When the list was prepared**

 The date that the list was prepared.

 The actual important date is the date of currency of the resources that were summarized, but it is usually assumed that these are current when the preparation occurs. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Who and/or what defined the list contents (aka Author)**

 The entity responsible for deciding what the contents of the list were. Where the list was created by a human, this is the same as the author of the list.

 The primary source is the entity that made the decisions what items are in the list. This may be software or user. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "source")]
    pub source: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_source")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_ext: Option<FieldExtension>,
    /** **[ListOrder](http://hl7.org/fhir/ValueSet/list-order); What order the list has**

 What order applies to the items in the list.

 Applications SHOULD render ordered lists in the order provided, but MAY allow users to re-order based on their own preferences as well. If there is no order specified, the order is unknown, though there may still be some order. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "orderedBy")]
    pub ordered_by: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_orderedBy")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub ordered_by_ext: Option<FieldExtension>,
    /** **Comments about the list**

 Comments that apply to the overall list.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
    /** **Entries in the list**

 Entries in this list.

 If there are no entries in the list, an emptyReason SHOULD be provided. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "entry")]
    pub entry: Vec<Option<ListEntry>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_entry")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub entry_ext: Vec<Option<FieldExtension>>,
    /** **[ListEmptyReason](http://hl7.org/fhir/ValueSet/list-empty-reason); Why list is empty**

 If the list is empty, why the list is empty.

 The various reasons for an empty list make a significant interpretation to its interpretation. Note that this code is for use when the entire list has been suppressed, and not for when individual items are omitted - implementers may consider using a text note or a flag on an entry in these cases. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "emptyReason")]
    pub empty_reason: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_emptyReason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub empty_reason_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ListBuilder {
    #[doc = concat!("Finalize building ", "List", ".")]
    pub fn build(self) -> Result<List, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ListInner> for List {
    fn from(inner: ListInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for List {
    type Target = ListInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for List {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl List {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ListBuilder {
        ListBuilder::default()
    }
}
impl List {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::List
    }
}
/// Sub-fields of the entry field in List
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ListEntryBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ListEntry {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ListItemFlag](http://hl7.org/fhir/ValueSet/list-item-flag); Status/Workflow information about this item**

 The flag allows the system constructing the list to indicate the role and significance of the item in the list.

 The flag can only be understood in the context of the List.code. If the flag means that the entry has actually been deleted from the list, the deleted element SHALL be true. Deleted can only be used if the List.mode is "changes". */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "flag")]
    pub flag: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_flag")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub flag_ext: Option<FieldExtension>,
    /** **If this item is actually marked as deleted**

 True if this item is marked as deleted in the list.

 If the flag means that the entry has actually been deleted from the list, the deleted element SHALL be true. Both flag and deleted can only be used if the List.mode is "changes". A deleted entry should be displayed in narrative as deleted.

This element is labeled as a modifier because it indicates that an item is (to be) no longer in the list. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "deleted")]
    pub deleted: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_deleted")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub deleted_ext: Option<FieldExtension>,
    /** **When item added to list**

 When this item was added to the list.

 This is only useful and meaningful when the mode is "working". */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Actual entry**

 A reference to the actual resource from which data was derived.

 */
    #[serde(rename = "item")]
    pub item: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_item")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub item_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ListEntry {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ListEntryBuilder {
        ListEntryBuilder::default()
    }
}
/** Base StructureDefinition for Location Resource

 **[Location](http://hl7.org/fhir/StructureDefinition/Location) v3.0.2**

 Details and position information for a physical place

 Details and position information for a physical place where services are provided  and resources and participants may be stored, found, contained or accommodated.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Location(pub Box<LocationInner>);
/** Base StructureDefinition for Location Resource

 **[Location](http://hl7.org/fhir/StructureDefinition/Location) v3.0.2**

 Details and position information for a physical place

 Details and position information for a physical place where services are provided  and resources and participants may be stored, found, contained or accommodated.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "LocationBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct LocationInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Location::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Location", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Unique code or number identifying the location to its users**

 Unique code or number identifying the location to its users.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[LocationStatus](http://hl7.org/fhir/ValueSet/location-status); active | suspended | inactive**

 The status property covers the general availability of the resource, not the current value which may be covered by the operationStatus, or by a schedule/slots if they are configured for the location.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<codes::LocationStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[OperationalStatus](http://hl7.org/fhir/ValueSet/v2-0116); The Operational status of the location (typically only for a bed/room)**

 The Operational status covers operation values most relevant to beds (but can also apply to rooms/units/chair/etc such as an isolation unit/dialisys chair). This typically covers concepts such as contamination, housekeeping and other activities like maintenance.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "operationalStatus")]
    pub operational_status: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_operationalStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub operational_status_ext: Option<FieldExtension>,
    /** **Name of the location as used by humans**

 Name of the location as used by humans. Does not need to be unique.

 If the name of an location changes, consider putting the old name in the alias column so that it can still be located through searches. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **A list of alternate names that the location is known as, or was known as in the past**

 A list of alternate names that the location is known as, or was known as in the past.

 There are no dates associated with the alias/historic names, as this is not intended to track when names were used, but to assist in searching so that older names can still result in identifying the location. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "alias")]
    pub alias: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_alias")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub alias_ext: Vec<Option<FieldExtension>>,
    /** **Additional details about the location that could be displayed as further information to identify the location beyond its name**

 Description of the Location, which helps in finding or referencing the place.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **[LocationMode](http://hl7.org/fhir/ValueSet/location-mode); instance | kind**

 Indicates whether a resource instance represents a specific location or a class of locations.

 This is labeled as a modifer because whether or not the location is a class of locations changes how it can be used and understood. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "mode")]
    pub mode: Option<codes::LocationMode>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_mode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub mode_ext: Option<FieldExtension>,
    /** **[LocationType](http://hl7.org/fhir/ValueSet/v3-ServiceDeliveryLocationRoleType); Type of function performed**

 Indicates the type of function performed at the location.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Contact details of the location**

 The contact details of communication devices available at the location. This can include phone numbers, fax numbers, mobile numbers, email addresses and web sites.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "telecom")]
    pub telecom: Vec<Option<ContactPoint>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_telecom")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub telecom_ext: Vec<Option<FieldExtension>>,
    /** **Physical location**

 Physical location.

 This was kept as 0..1 as there is no use property on the address, so wouldn't be able to identify different address types. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "address")]
    pub address: Option<Address>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_address")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub address_ext: Option<FieldExtension>,
    /** **[PhysicalType](http://hl7.org/fhir/ValueSet/location-physical-type); Physical form of the location**

 Physical form of the location, e.g. building, room, vehicle, road.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "physicalType")]
    pub physical_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_physicalType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub physical_type_ext: Option<FieldExtension>,
    /** **The absolute geographic location**

 The absolute geographic location of the Location, expressed using the WGS84 datum (This is the same co-ordinate system used in KML).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "position")]
    pub position: Option<LocationPosition>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_position")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub position_ext: Option<FieldExtension>,
    /** **Organization responsible for provisioning and upkeep**

 The organization responsible for the provisioning and upkeep of the location.

 This can also be used as the part of the organization hierarchy where this location provides services. These services can be defined through the HealthcareService resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "managingOrganization")]
    pub managing_organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_managingOrganization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub managing_organization_ext: Option<FieldExtension>,
    /** **Another Location this one is physically part of**

 Another Location which this Location is physically part of.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "partOf")]
    pub part_of: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_partOf")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub part_of_ext: Option<FieldExtension>,
    /** **Technical endpoints providing access to services operated for the location**

 Technical endpoints providing access to services operated for the location.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endpoint")]
    pub endpoint: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_endpoint")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub endpoint_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl LocationBuilder {
    #[doc = concat!("Finalize building ", "Location", ".")]
    pub fn build(self) -> Result<Location, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<LocationInner> for Location {
    fn from(inner: LocationInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Location {
    type Target = LocationInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Location {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Location {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> LocationBuilder {
        LocationBuilder::default()
    }
}
impl Location {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Location
    }
}
/// Sub-fields of the position field in Location
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "LocationPositionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct LocationPosition {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Longitude with WGS84 datum**

 Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below).

 */
    #[serde(rename = "longitude")]
    pub longitude: f64,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_longitude")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub longitude_ext: Option<FieldExtension>,
    /** **Latitude with WGS84 datum**

 Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below).

 */
    #[serde(rename = "latitude")]
    pub latitude: f64,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_latitude")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub latitude_ext: Option<FieldExtension>,
    /** **Altitude with WGS84 datum**

 Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "altitude")]
    pub altitude: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_altitude")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub altitude_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl LocationPosition {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> LocationPositionBuilder {
        LocationPositionBuilder::default()
    }
}
/** Base StructureDefinition for Measure Resource

 **[Measure](http://hl7.org/fhir/StructureDefinition/Measure) v3.0.2**

 A quality measure definition

 The Measure resource provides the definition of a quality measure.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Measure(pub Box<MeasureInner>);
/** Base StructureDefinition for Measure Resource

 **[Measure](http://hl7.org/fhir/StructureDefinition/Measure) v3.0.2**

 A quality measure definition

 The Measure resource provides the definition of a quality measure.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MeasureBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct MeasureInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Measure::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Measure", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical URI to reference this measure (globally unique)**

 An absolute URI that is used to identify this measure when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this measure is (or will be) published. The URL SHOULD include the major version of the measure. For more information see [Technical and Business Versions](resource.html#versions).

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred.  Multiple instances may share the same url if they have a distinct version. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "url")]
    pub url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Additional identifier for the measure**

 A formal identifier that is used to identify this measure when it is represented in other formats, or referenced in a specification, model, design or an instance.

 Typically, this is used for identifiers that can go in an HL7 V3 II (instance identifier) data type, e.g., to identify this measure outside of FHIR, where it is not possible to use the logical URI. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Business version of the measure**

 The identifier that is used to identify this version of the measure when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the measure author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge assets, refer to the Decision Support Service specification. Note that a version is required for non-experimental active artifacts.

 There may be different measure instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a refrence to a particular business version of the measure with the format [url]|[version]. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Name for this measure (computer friendly)**

 A natural language name identifying the measure. This name should be usable as an identifier for the module by machine processing applications such as code generation.

 The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure that it is computable friendly. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Name for this measure (human friendly)**

 A short, descriptive, user-friendly title for the measure.

 This name does not need to be machine-processing friendly and may contain punctuation, white-space, etc. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this measure. Enables tracking the life-cycle of the content.

 Allows filtering of measures that are appropriate for use vs. not.
This is labeled as "Is Modifier" because applications should not use a retired measure without due consideration. */
    #[serde(rename = "status")]
    pub status: codes::PublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **For testing purposes, not real usage**

 A boolean value to indicate that this measure is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of measure that are appropriate for use vs. not. This is labeled as "Is Modifier" because applications should not use an experimental measure in production. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "experimental")]
    pub experimental: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_experimental")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub experimental_ext: Option<FieldExtension>,
    /** **Date this was last changed**

 The date  (and optionally time) when the measure was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the measure changes.

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the measure. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Name of the publisher (organization or individual)**

 The name of the individual or organization that published the measure.

 Usually an organization, but may be an individual. The publisher (or steward) of the measure is the organization or individual primarily responsible for the maintenance and upkeep of the measure. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the measure. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisher")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_ext: Option<FieldExtension>,
    /** **Natural language description of the measure**

 A free text natural language description of the measure from a consumer's perspective.

 This description can be used to capture details such as why the measure was built, comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the measure as conveyed in the 'text' field of the resource itself. This item SHOULD be populated unless the information is available from context (e.g. the language of the profile is presumed to be the predominant language in the place the profile was created). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Why this measure is defined**

 Explaination of why this measure is needed and why it has been designed as it has.

 This element does not describe the usage of the measure Instead  it provides traceability of ''why'' the resource is either needed or ''why'' it is defined as it is.  This may be used to point to source materials or specifications that drove the structure of this measure. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purpose")]
    pub purpose: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_purpose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub purpose_ext: Option<FieldExtension>,
    /** **Describes the clinical usage of the measure**

 A detailed description of how the measure is used from a clinical perspective.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "usage")]
    pub usage: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_usage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub usage_ext: Option<FieldExtension>,
    /** **When the measure was approved by publisher**

 The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.

 The 'date' element may be more recent than the approval date because of minor changes / editorial corrections. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "approvalDate")]
    pub approval_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_approvalDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub approval_date_ext: Option<FieldExtension>,
    /** **When the measure was last reviewed**

 The date on which the resource content was last reviewed. Review happens periodically after approval, but doesn't change the original approval date.

 If specified, this is usually after the approval date. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "lastReviewDate")]
    pub last_review_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_lastReviewDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub last_review_date_ext: Option<FieldExtension>,
    /** **When the measure is expected to be used**

 The period during which the measure content was or is planned to be in active use.

 The effective period for a measure  determines when the content is applicable for usage and is independent of publication and review dates. For example, a measure intended to be used for the year 2016 might be published in 2015. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "effectivePeriod")]
    pub effective_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_effectivePeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub effective_period_ext: Option<FieldExtension>,
    /** **Context the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate measure instances.

 When multiple useContexts are specified, there is no expectation whether all or any of the contexts apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useContext")]
    pub use_context: Vec<Option<UsageContext>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_useContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_context_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Intended jurisdiction for measure (if applicable)**

 A legal or geographic region in which the measure is intended to be used.

 It may be possible for the measure to be used in jurisdictions other than those for which it was originally designed or intended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **[DefinitionTopic](http://hl7.org/fhir/ValueSet/definition-topic); E.g. Education, Treatment, Assessment, etc**

 Descriptive topics related to the content of the measure. Topics provide a high-level categorization of the type of the measure that can be useful for filtering and searching.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "topic")]
    pub topic: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_topic")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub topic_ext: Vec<Option<FieldExtension>>,
    /** **A content contributor**

 A contributor to the content of the measure, including authors, editors, reviewers, and endorsers.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contributor")]
    pub contributor: Vec<Option<Contributor>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contributor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contributor_ext: Vec<Option<FieldExtension>>,
    /** **Contact details for the publisher**

 Contact details to assist a user in finding and communicating with the publisher.

 May be a web site, an email address, a telephone number, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Use and/or publishing restrictions**

 A copyright statement relating to the measure and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the measure.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyright")]
    pub copyright: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyright")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_ext: Option<FieldExtension>,
    /** **Additional documentation, citations, etc**

 Related artifacts such as additional documentation, justification, or bibliographic references.

 Each related artifact is either an attachment, or a reference to another resource, but not both. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relatedArtifact")]
    pub related_artifact: Vec<Option<RelatedArtifact>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_relatedArtifact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub related_artifact_ext: Vec<Option<FieldExtension>>,
    /** **Logic used by the measure**

 A reference to a Library resource containing the formal logic used by the measure.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "library")]
    pub library: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_library")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub library_ext: Vec<Option<FieldExtension>>,
    /** **Disclaimer for use of the measure or its referenced content**

 Notices and disclaimers regarding the use of the measure, or related to intellectual property (such as code systems) referenced by the measure.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "disclaimer")]
    pub disclaimer: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_disclaimer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub disclaimer_ext: Option<FieldExtension>,
    /** **[MeasureScoring](http://hl7.org/fhir/ValueSet/measure-scoring); proportion | ratio | continuous-variable | cohort**

 Indicates how the calculation is performed for the measure, including proportion, ratio, continuous variable, and cohort. The value set is extensible, allowing additional measure scoring types to be represented.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "scoring")]
    pub scoring: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_scoring")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub scoring_ext: Option<FieldExtension>,
    /** **[CompositeMeasureScoring](http://hl7.org/fhir/ValueSet/composite-measure-scoring); opportunity | all-or-nothing | linear | weighted**

 If this is a composite measure, the scoring method used to combine the component measures to determine the composite score.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "compositeScoring")]
    pub composite_scoring: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_compositeScoring")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub composite_scoring_ext: Option<FieldExtension>,
    /** **[MeasureType](http://hl7.org/fhir/ValueSet/measure-type); process | outcome | structure | patient-reported-outcome | composite**

 Indicates whether the measure is used to examine a process, an outcome over time, a patient-reported outcome, or a structure measure such as utilization.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub r#type_ext: Vec<Option<FieldExtension>>,
    /** **How is risk adjustment applied for this measure**

 A description of the risk adjustment factors that may impact the resulting score for the measure and how they may be accounted for when computing and reporting measure results.

 Describes the method of adjusting for clinical severity and conditions present at the start of care that can influence patient outcomes for making valid comparisons of outcome measures across providers. Indicates whether an eMeasure is subject to the statistical process for reducing, removing, or clarifying the influences of confounding factors to allow more useful comparisons. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "riskAdjustment")]
    pub risk_adjustment: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_riskAdjustment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub risk_adjustment_ext: Option<FieldExtension>,
    /** **How is rate aggregation performed for this measure**

 Describes how to combine the information calculated, based on logic in each of several populations, into one summarized result.

 The measure rate for an organization or clinician is based upon the entities’ aggregate data and summarizes the performance of the entity over a given time period (e.g., monthly, quarterly, yearly). The aggregated data are derived from the results of a specific measure algorithm and, if appropriate, the application of specific risk adjustment models.  Can also be used to describe how to risk adjust the data based on supplemental data elements described in the eMeasure (e.g., pneumonia hospital measures antibiotic selection in the ICU versus non-ICU and then the roll-up of the two). This could be applied to aggregated cohort measure definitions (e.g., CDC's aggregate reporting for TB at the state level). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "rateAggregation")]
    pub rate_aggregation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_rateAggregation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub rate_aggregation_ext: Option<FieldExtension>,
    /** **Why does this measure exist**

 Provides a succint statement of the need for the measure. Usually includes statements pertaining to importance criterion: impact, gap in care, and evidence.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "rationale")]
    pub rationale: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_rationale")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub rationale_ext: Option<FieldExtension>,
    /** **Summary of clinical guidelines**

 Provides a summary of relevant clinical guidelines or other clinical recommendations supporting the measure.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "clinicalRecommendationStatement")]
    pub clinical_recommendation_statement: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_clinicalRecommendationStatement")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub clinical_recommendation_statement_ext: Option<FieldExtension>,
    /** **Improvement notation for the measure, e.g. higher score indicates better quality**

 Information on whether an increase or decrease in score is the preferred result (e.g., a higher score indicates better quality OR a lower score indicates better quality OR quality is whthin a range).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "improvementNotation")]
    pub improvement_notation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_improvementNotation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub improvement_notation_ext: Option<FieldExtension>,
    /** **Defined terms used in the measure documentation**

 Provides a description of an individual term used within the measure.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definition")]
    pub definition: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_definition")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub definition_ext: Vec<Option<FieldExtension>>,
    /** **Additional guidance for implementers**

 Additional guidance for the measure including how it can be used in a clinical context, and the intent of the measure.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "guidance")]
    pub guidance: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_guidance")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub guidance_ext: Option<FieldExtension>,
    /** **The measure set, e.g. Preventive Care and Screening**

 The measure set, e.g. Preventive Care and Screening.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "set")]
    pub set: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_set")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub set_ext: Option<FieldExtension>,
    /** **Population criteria group**

 A group of population criteria for the measure.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "group")]
    pub group: Vec<Option<MeasureGroup>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_group")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub group_ext: Vec<Option<FieldExtension>>,
    /** **What other data should be reported with the measure**

 The supplemental data criteria for the measure report, specified as either the name of a valid CQL expression within a referenced library, or a valid FHIR Resource Path.

 Note that supplemental data are reported as observations for each patient and included in the evaluatedResources bundle. See the MeasureReport resource or the Quality Reporting topic for more information. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "supplementalData")]
    pub supplemental_data: Vec<Option<MeasureSupplementalData>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_supplementalData")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub supplemental_data_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl MeasureBuilder {
    #[doc = concat!("Finalize building ", "Measure", ".")]
    pub fn build(self) -> Result<Measure, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<MeasureInner> for Measure {
    fn from(inner: MeasureInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Measure {
    type Target = MeasureInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Measure {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Measure {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> MeasureBuilder {
        MeasureBuilder::default()
    }
}
impl Measure {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Measure
    }
}
/// Sub-fields of the group field in Measure
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MeasureGroupBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MeasureGroup {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Unique identifier**

 A unique identifier for the group. This identifier will used to report data for the group in the measure report.

 */
    #[serde(rename = "identifier")]
    pub identifier: Identifier,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **Short name**

 Optional name or short description of this group.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Summary description**

 The human readable description of this population group.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Population criteria**

 A population criteria for the measure.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "population")]
    pub population: Vec<Option<MeasureGroupPopulation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_population")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub population_ext: Vec<Option<FieldExtension>>,
    /** **Stratifier criteria for the measure**

 The stratifier criteria for the measure report, specified as either the name of a valid CQL expression defined within a referenced library, or a valid FHIR Resource Path.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "stratifier")]
    pub stratifier: Vec<Option<MeasureGroupStratifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_stratifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub stratifier_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl MeasureGroup {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MeasureGroupBuilder {
        MeasureGroupBuilder::default()
    }
}
/// Sub-fields of the population field in MeasureGroup
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MeasureGroupPopulationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MeasureGroupPopulation {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Unique identifier**

 A unique identifier for the population criteria. This identifier is used to report data against this criteria within the measure report.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **[MeasurePopulationType](http://hl7.org/fhir/ValueSet/measure-population); initial-population | numerator | numerator-exclusion | denominator | denominator-exclusion | denominator-exception | measure-population | measure-population-exclusion | measure-observation**

 The type of population criteria.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Short name**

 Optional name or short description of this population.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **The human readable description of this population criteria**

 The human readable description of this population criteria.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **The name of a valid referenced CQL expression (may be namespaced) that defines this population criteria**

 The name of a valid referenced CQL expression (may be namespaced) that defines this population criteria.

 In the case of a continuous variable or ratio measure, this may be the name of a function that calculates the value of the individual observation for each patient or event in the population. For these types of measures, individual observations are reported as observation resources included in the evaluatedResources bundle for each patient. See the MeasureReport resource or the Quality Reporting topic for more information. */
    #[serde(rename = "criteria")]
    pub criteria: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_criteria")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub criteria_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MeasureGroupPopulation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MeasureGroupPopulationBuilder {
        MeasureGroupPopulationBuilder::default()
    }
}
/// Sub-fields of the stratifier field in MeasureGroup
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MeasureGroupStratifierBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MeasureGroupStratifier {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **The identifier for the stratifier used to coordinate the reported data back to this stratifier**

 The identifier for the stratifier used to coordinate the reported data back to this stratifier.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **How the measure should be stratified**

 The criteria for the stratifier. This must be the name of an expression defined within a referenced library.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "criteria")]
    pub criteria: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_criteria")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub criteria_ext: Option<FieldExtension>,
    /** **Path to the stratifier**

 The path to an element that defines the stratifier, specified as a valid FHIR resource path.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "path")]
    pub path: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_path")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub path_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MeasureGroupStratifier {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MeasureGroupStratifierBuilder {
        MeasureGroupStratifierBuilder::default()
    }
}
/// Sub-fields of the supplementalData field in Measure
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MeasureSupplementalDataBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MeasureSupplementalData {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Identifier, unique within the measure**

 An identifier for the supplemental data.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **[MeasureDataUsage](http://hl7.org/fhir/ValueSet/measure-data-usage); supplemental-data | risk-adjustment-factor**

 An indicator of the intended usage for the supplemental data element. Supplemental data indicates the data is additional information requested to augment the measure information. Risk adjustment factor indicates the data is additional information used to calculate risk adjustment factors when applying a risk model to the measure calculation.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "usage")]
    pub usage: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_usage")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub usage_ext: Vec<Option<FieldExtension>>,
    /** **Expression describing additional data to be reported**

 The criteria for the supplemental data. This must be the name of a valid expression defined within a referenced library, and defines the data to be returned for this element.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "criteria")]
    pub criteria: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_criteria")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub criteria_ext: Option<FieldExtension>,
    /** **Path to the supplemental data element**

 The supplemental data to be supplied as part of the measure response, specified as a valid FHIR Resource Path.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "path")]
    pub path: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_path")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub path_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MeasureSupplementalData {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MeasureSupplementalDataBuilder {
        MeasureSupplementalDataBuilder::default()
    }
}
/** Base StructureDefinition for MeasureReport Resource

 **[MeasureReport](http://hl7.org/fhir/StructureDefinition/MeasureReport) v3.0.2**

 Results of a measure evaluation

 The MeasureReport resource contains the results of evaluating a measure.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct MeasureReport(pub Box<MeasureReportInner>);
/** Base StructureDefinition for MeasureReport Resource

 **[MeasureReport](http://hl7.org/fhir/StructureDefinition/MeasureReport) v3.0.2**

 Results of a measure evaluation

 The MeasureReport resource contains the results of evaluating a measure.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MeasureReportBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct MeasureReportInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "MeasureReport::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::MeasureReport", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Additional identifier for the Report**

 A formal identifier that is used to identify this report when it is represented in other formats, or referenced in a specification, model, design or an instance.

 Typically, this is used for identifiers that can go in an HL7 v3 II data type - e.g. to identify this {{title}} outside of FHIR, where the logical URL is not possible to use. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **[MeasureReportStatus](http://hl7.org/fhir/ValueSet/measure-report-status); complete | pending | error**

 The report status. No data will be available until the report status is complete.

 */
    #[serde(rename = "status")]
    pub status: codes::MeasureReportStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[MeasureReportType](http://hl7.org/fhir/ValueSet/measure-report-type); individual | patient-list | summary**

 The type of measure report. This may be an individual report, which provides a single patient's score for the measure; a patient listing, which returns the list of patients that meet the various criteria in the measure; or a summary report, which returns a population count for each of the criteria in the measure.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(rename = "type")]
    pub r#type: codes::MeasureReportType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **What measure was evaluated**

 A reference to the Measure that was evaluated to produce this report.

 */
    #[serde(rename = "measure")]
    pub measure: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_measure")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub measure_ext: Option<FieldExtension>,
    /** **What patient the report is for**

 Optional Patient if the report was requested for a single patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patient")]
    pub patient: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_ext: Option<FieldExtension>,
    /** **When the report was generated**

 The date this measure report was generated.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Who is reporting the data**

 Reporting Organization.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reportingOrganization")]
    pub reporting_organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reportingOrganization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reporting_organization_ext: Option<FieldExtension>,
    /** **What period the report covers**

 The reporting period for which the report was calculated.

 */
    #[serde(rename = "period")]
    pub period: Period,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
    /** **Measure results for each group**

 The results of the calculation, one for each population group in the measure.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "group")]
    pub group: Vec<Option<MeasureReportGroup>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_group")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub group_ext: Vec<Option<FieldExtension>>,
    /** **What data was evaluated to produce the measure score**

 A reference to a Bundle containing the Resources that were used in the evaluation of this report.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "evaluatedResources")]
    pub evaluated_resources: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_evaluatedResources")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub evaluated_resources_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MeasureReportBuilder {
    #[doc = concat!("Finalize building ", "MeasureReport", ".")]
    pub fn build(self) -> Result<MeasureReport, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<MeasureReportInner> for MeasureReport {
    fn from(inner: MeasureReportInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for MeasureReport {
    type Target = MeasureReportInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for MeasureReport {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl MeasureReport {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> MeasureReportBuilder {
        MeasureReportBuilder::default()
    }
}
impl MeasureReport {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::MeasureReport
    }
}
/// Sub-fields of the group field in MeasureReport
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MeasureReportGroupBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MeasureReportGroup {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **What group of the measure**

 The identifier of the population group as defined in the measure definition.

 */
    #[serde(rename = "identifier")]
    pub identifier: Identifier,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **The populations in the group**

 The populations that make up the population group, one for each type of population appropriate for the measure.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "population")]
    pub population: Vec<Option<MeasureReportGroupPopulation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_population")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub population_ext: Vec<Option<FieldExtension>>,
    /** **What score this group achieved**

 The measure score for this population group, calculated as appropriate for the measure type and scoring method, and based on the contents of the populations defined in the group.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "measureScore")]
    pub measure_score: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_measureScore")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub measure_score_ext: Option<FieldExtension>,
    /** **Stratification results**

 When a measure includes multiple stratifiers, there will be a stratifier group for each stratifier defined by the measure.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "stratifier")]
    pub stratifier: Vec<Option<MeasureReportGroupStratifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_stratifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub stratifier_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl MeasureReportGroup {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MeasureReportGroupBuilder {
        MeasureReportGroupBuilder::default()
    }
}
/// Sub-fields of the population field in MeasureReportGroup
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MeasureReportGroupPopulationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MeasureReportGroupPopulation {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Population identifier as defined in the measure**

 The identifier of the population being reported, as defined by the population element of the measure.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **[MeasurePopulation](http://hl7.org/fhir/ValueSet/measure-population); initial-population | numerator | numerator-exclusion | denominator | denominator-exclusion | denominator-exception | measure-population | measure-population-exclusion | measure-score**

 The type of the population.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Size of the population**

 The number of members of the population.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "count")]
    pub count: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_count")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub count_ext: Option<FieldExtension>,
    /** **For patient-list reports, the patients in this population**

 This element refers to a List of patient level MeasureReport resources, one for each patient in this population.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patients")]
    pub patients: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patients")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patients_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MeasureReportGroupPopulation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MeasureReportGroupPopulationBuilder {
        MeasureReportGroupPopulationBuilder::default()
    }
}
/// Sub-fields of the stratifier field in MeasureReportGroup
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MeasureReportGroupStratifierBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MeasureReportGroupStratifier {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **What stratifier of the group**

 The identifier of this stratifier, as defined in the measure definition.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **Stratum results, one for each unique value in the stratifier**

 This element contains the results for a single stratum within the stratifier. For example, when stratifying on administrative gender, there will be four strata, one for each possible gender value.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "stratum")]
    pub stratum: Vec<Option<MeasureReportGroupStratifierStratum>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_stratum")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub stratum_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl MeasureReportGroupStratifier {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MeasureReportGroupStratifierBuilder {
        MeasureReportGroupStratifierBuilder::default()
    }
}
/// Sub-fields of the stratum field in MeasureReportGroupStratifier
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MeasureReportGroupStratifierStratumBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MeasureReportGroupStratifierStratum {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **The stratum value, e.g. male**

 The value for this stratum, expressed as a string. When defining stratifiers on complex values, the value must be rendered such that the value for each stratum within the stratifier is unique.

 */
    #[serde(rename = "value")]
    pub value: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_value")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<FieldExtension>,
    /** **Population results in this stratum**

 The populations that make up the stratum, one for each type of population appropriate to the measure.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "population")]
    pub population: Vec<Option<MeasureReportGroupStratifierStratumPopulation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_population")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub population_ext: Vec<Option<FieldExtension>>,
    /** **What score this stratum achieved**

 The measure score for this stratum, calculated as appropriate for the measure type and scoring method, and based on only the members of this stratum.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "measureScore")]
    pub measure_score: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_measureScore")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub measure_score_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MeasureReportGroupStratifierStratum {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MeasureReportGroupStratifierStratumBuilder {
        MeasureReportGroupStratifierStratumBuilder::default()
    }
}
/// Sub-fields of the population field in MeasureReportGroupStratifierStratum
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MeasureReportGroupStratifierStratumPopulationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MeasureReportGroupStratifierStratumPopulation {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Population identifier as defined in the measure**

 The identifier of the population being reported, as defined by the population element of the measure.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **[MeasurePopulation](http://hl7.org/fhir/ValueSet/measure-population); initial-population | numerator | numerator-exclusion | denominator | denominator-exclusion | denominator-exception | measure-population | measure-population-exclusion | measure-score**

 The type of the population.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Size of the population**

 The number of members of the population in this stratum.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "count")]
    pub count: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_count")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub count_ext: Option<FieldExtension>,
    /** **For patient-list reports, the patients in this population**

 This element refers to a List of patient level MeasureReport resources, one for each patient in this population in this stratum.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patients")]
    pub patients: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patients")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patients_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MeasureReportGroupStratifierStratumPopulation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MeasureReportGroupStratifierStratumPopulationBuilder {
        MeasureReportGroupStratifierStratumPopulationBuilder::default()
    }
}
/** Base StructureDefinition for Media Resource

 **[Media](http://hl7.org/fhir/StructureDefinition/Media) v3.0.2**

 A photo, video, or audio recording acquired or used in healthcare. The actual content may be inline or provided by direct reference

 A photo, video, or audio recording acquired or used in healthcare. The actual content may be inline or provided by direct reference.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Media(pub Box<MediaInner>);
/** Base StructureDefinition for Media Resource

 **[Media](http://hl7.org/fhir/StructureDefinition/Media) v3.0.2**

 A photo, video, or audio recording acquired or used in healthcare. The actual content may be inline or provided by direct reference

 A photo, video, or audio recording acquired or used in healthcare. The actual content may be inline or provided by direct reference.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MediaBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct MediaInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Media::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Media", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Identifier(s) for the image**

 Identifiers associated with the image - these may include identifiers for the image itself, identifiers for the context of its collection (e.g. series ids) and context ids such as accession numbers or other workflow identifiers.

 The identifier label and use can be used to determine what kind of identifier it is. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Procedure that caused this media to be created**

 A procedure that is fulfilled in whole or in part by the creation of this media.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basedOn")]
    pub based_on: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_basedOn")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub based_on_ext: Vec<Option<FieldExtension>>,
    /** **[DigitalMediaType](http://hl7.org/fhir/ValueSet/digital-media-type); photo | video | audio**

 Whether the media is a photo (still image), an audio recording, or a video recording.

 */
    #[serde(rename = "type")]
    pub r#type: codes::DigitalMediaType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[DigitalMediaSubtype](http://hl7.org/fhir/ValueSet/digital-media-subtype); The type of acquisition equipment/process**

 Details of the type of the media - usually, how it was acquired (what type of device). If images sourced from a DICOM system, are wrapped in a Media resource, then this is the modality.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subtype")]
    pub subtype: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subtype")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subtype_ext: Option<FieldExtension>,
    /** **[MediaView](http://hl7.org/fhir/ValueSet/media-view); Imaging view, e.g. Lateral or Antero-posterior**

 The name of the imaging view e.g. Lateral or Antero-posterior (AP).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "view")]
    pub view: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_view")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub view_ext: Option<FieldExtension>,
    /** **Who/What this Media is a record of**

 Who/What this Media is a record of.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Encounter / Episode associated with media**

 The encounter or episode of care that establishes the context for this media.

 This will typically be the encounter the media occurred within. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **When Media was collected**

 The date and time(s) at which the media was collected.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub occurrence: Option<MediaOccurrence>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub occurrence_ext: Option<MediaOccurrenceExtension>,
    /** **The person who generated the image**

 The person who administered the collection of the image.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "operator")]
    pub operator: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_operator")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub operator_ext: Option<FieldExtension>,
    /** **[MediaReason](http://hl7.org/fhir/ValueSet/procedure-reason); Why was event performed?**

 Describes why the event occurred in coded or textual form.

 Textual reasons can be caprued using reasonCode.text. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonCode")]
    pub reason_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_code_ext: Vec<Option<FieldExtension>>,
    /** **[BodySite](http://hl7.org/fhir/ValueSet/body-site); Body part in media**

 Indicates the site on the subject's body where the media was collected (i.e. the target site).

 If the use case requires BodySite to be handled as a separate resource (e.g. to identify and track separately) then use The standard extension[ body-site-instance](extension-body-site-instance.html). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "bodySite")]
    pub body_site: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_bodySite")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub body_site_ext: Option<FieldExtension>,
    /** **Observing Device**

 The device used to collect the media.

 An extension should be used if further typing of the device is needed.  Scondary devices used to support collecting a media can be represented using either extension or through the Observation.related element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "device")]
    pub device: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_device")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub device_ext: Option<FieldExtension>,
    /** **Height of the image in pixels (photo/video)**

 Height of the image in pixels (photo/video).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "height")]
    pub height: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_height")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub height_ext: Option<FieldExtension>,
    /** **Width of the image in pixels (photo/video)**

 Width of the image in pixels (photo/video).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "width")]
    pub width: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_width")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub width_ext: Option<FieldExtension>,
    /** **Number of frames if > 1 (photo)**

 The number of frames in a photo. This is used with a multi-page fax, or an imaging acquisition context that takes multiple slices in a single image, or an animated gif. If there is more than one frame, this SHALL have a value in order to alert interface software that a multi-frame capable rendering widget is required.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "frames")]
    pub frames: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_frames")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub frames_ext: Option<FieldExtension>,
    /** **Length in seconds (audio / video)**

 The duration of the recording in seconds - for audio and video.

 The duration might differ from occurrencePeriod if recording was paused. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "duration")]
    pub duration: Option<u32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_duration")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub duration_ext: Option<FieldExtension>,
    /** **Actual Media - reference or data**

 The actual content of the media - inline or by direct reference to the media source file.

 Recommended content types: image/jpeg, image/png, image/tiff, video/mpeg, audio/mp4, application/dicom. Application/dicom can contain the transfer syntax as a parameter.  For an media that covers a period of time (video/sound), the content.creationTime is the end time. Creation time is used for tracking, organizing versions and searching. */
    #[serde(rename = "content")]
    pub content: Attachment,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_content")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub content_ext: Option<FieldExtension>,
    /** **Comments made about the media**

 Comments made about the media by the performer, subject or other participants.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl MediaBuilder {
    #[doc = concat!("Finalize building ", "Media", ".")]
    pub fn build(self) -> Result<Media, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<MediaInner> for Media {
    fn from(inner: MediaInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Media {
    type Target = MediaInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Media {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Media {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> MediaBuilder {
        MediaBuilder::default()
    }
}
impl Media {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Media
    }
}
/// Choice of types for the occurrence[x] field in Media
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MediaOccurrence {
    /// Variant accepting the DateTime type.
    #[serde(rename = "occurrenceDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "occurrencePeriod")]
    Period(Period),
}
/// Extension value for MediaOccurrence.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MediaOccurrenceExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_occurrenceDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_occurrencePeriod")]
    Period(FieldExtension),
}
/** Base StructureDefinition for Medication Resource

 **[Medication](http://hl7.org/fhir/StructureDefinition/Medication) v3.0.2**

 Definition of a Medication

 This resource is primarily used for the identification and definition of a medication. It covers the ingredients and the packaging for a medication.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Medication(pub Box<MedicationInner>);
/** Base StructureDefinition for Medication Resource

 **[Medication](http://hl7.org/fhir/StructureDefinition/Medication) v3.0.2**

 Definition of a Medication

 This resource is primarily used for the identification and definition of a medication. It covers the ingredients and the packaging for a medication.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct MedicationInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Medication::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Medication", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[MedicationFormalRepresentation](http://hl7.org/fhir/ValueSet/medication-codes); Codes that identify this medication**

 A code (or set of codes) that specify this medication, or a textual description if no code is available. Usage note: This could be a standard medication code such as a code from RxNorm, SNOMED CT, IDMP etc. It could also be a national or local formulary code, optionally with translations to other code systems.

 Depending on the context of use, the code that was actually selected by the user (prescriber, dispenser, etc.) will have the coding.userSelected set to true.  As described in the coding datatype: "A coding may be marked as a "userSelected" if a user selected the particular coded value in a user interface (e.g. the user selects an item in a pick-list). If a user selected coding exists, it is the preferred choice for performing translations etc. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **[MedicationStatus](http://hl7.org/fhir/ValueSet/medication-status); active | inactive | entered-in-error**

 A code to indicate if the medication is in active use.

 This status is not intended to specify if a medication is part of a formulary. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<codes::MedicationStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **True if a brand**

 Set to true if the item is attributable to a specific manufacturer.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "isBrand")]
    pub is_brand: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_isBrand")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub is_brand_ext: Option<FieldExtension>,
    /** **True if medication does not require a prescription**

 Set to true if the medication can be obtained without an order from a prescriber.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "isOverTheCounter")]
    pub is_over_the_counter: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_isOverTheCounter")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub is_over_the_counter_ext: Option<FieldExtension>,
    /** **Manufacturer of the item**

 Describes the details of the manufacturer of the medication product.  This is not intended to represent the distributor of a medication product.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "manufacturer")]
    pub manufacturer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_manufacturer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub manufacturer_ext: Option<FieldExtension>,
    /** **[MedicationForm](http://hl7.org/fhir/ValueSet/medication-form-codes); powder | tablets | capsule +**

 Describes the form of the item.  Powder; tablets; capsule.

 When Medication is referenced from MedicationRequest, this is the ordered form.  When Medication is referenced within MedicationDispense, this is the dispensed form.  When Medication is referenced within MedicationAdministration, this is administered form. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "form")]
    pub form: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_form")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub form_ext: Option<FieldExtension>,
    /** **Active or inactive ingredient**

 Identifies a particular constituent of interest in the product.

 The ingredients need not be a complete list.  If an ingredient is not specified, this does not indicate whether an ingredient is present or absent.  If an ingredient is specified it does not mean that all ingredients are specified.  It is possible to specify both inactive and active ingredients. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "ingredient")]
    pub ingredient: Vec<Option<MedicationIngredient>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_ingredient")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub ingredient_ext: Vec<Option<FieldExtension>>,
    /** **Details about packaged medications**

 Information that only applies to packages (not products).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "package")]
    pub package: Option<MedicationPackage>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_package")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub package_ext: Option<FieldExtension>,
    /** **Picture of the medication**

 Photo(s) or graphic representation(s) of the medication.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "image")]
    pub image: Vec<Option<Attachment>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_image")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub image_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl MedicationBuilder {
    #[doc = concat!("Finalize building ", "Medication", ".")]
    pub fn build(self) -> Result<Medication, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<MedicationInner> for Medication {
    fn from(inner: MedicationInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Medication {
    type Target = MedicationInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Medication {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Medication {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> MedicationBuilder {
        MedicationBuilder::default()
    }
}
impl Medication {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Medication
    }
}
/// Sub-fields of the ingredient field in Medication
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationIngredientBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationIngredient {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **The product contained**

 The actual ingredient - either a substance (simple ingredient) or another medication.

 */
    #[serde(flatten)]
    pub item: MedicationIngredientItem,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub item_ext: Option<MedicationIngredientItemExtension>,
    /** **Active ingredient indicator**

 Indication of whether this ingredient affects the therapeutic action of the drug.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "isActive")]
    pub is_active: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_isActive")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub is_active_ext: Option<FieldExtension>,
    /** **Quantity of ingredient present**

 Specifies how many (or how much) of the items there are in this Medication.  For example, 250 mg per tablet.  This is expressed as a ratio where the numerator is 250mg and the denominator is 1 tablet.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "amount")]
    pub amount: Option<Ratio>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_amount")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub amount_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MedicationIngredient {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationIngredientBuilder {
        MedicationIngredientBuilder::default()
    }
}
/// Choice of types for the item[x] field in MedicationIngredient
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationIngredientItem {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "itemCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "itemReference")]
    Reference(Reference),
}
/// Extension value for MedicationIngredientItem.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationIngredientItemExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_itemCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_itemReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the package field in Medication
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationPackageBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationPackage {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[MedicationContainer](http://hl7.org/fhir/ValueSet/medication-package-form); E.g. box, vial, blister-pack**

 The kind of container that this package comes as.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "container")]
    pub container: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_container")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub container_ext: Option<FieldExtension>,
    /** **What is  in the package**

 A set of components that go to make up the described item.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "content")]
    pub content: Vec<Option<MedicationPackageContent>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_content")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub content_ext: Vec<Option<FieldExtension>>,
    /** **Identifies a single production run**

 Information about a group of medication produced or packaged from one production run.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "batch")]
    pub batch: Vec<Option<MedicationPackageBatch>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_batch")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub batch_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl MedicationPackage {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationPackageBuilder {
        MedicationPackageBuilder::default()
    }
}
/// Sub-fields of the content field in MedicationPackage
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationPackageContentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationPackageContent {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **The item in the package**

 Identifies one of the items in the package.

 */
    #[serde(flatten)]
    pub item: MedicationPackageContentItem,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub item_ext: Option<MedicationPackageContentItemExtension>,
    /** **Quantity present in the package**

 The amount of the product that is in the package.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "amount")]
    pub amount: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_amount")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub amount_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MedicationPackageContent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationPackageContentBuilder {
        MedicationPackageContentBuilder::default()
    }
}
/// Choice of types for the item[x] field in MedicationPackageContent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationPackageContentItem {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "itemCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "itemReference")]
    Reference(Reference),
}
/// Extension value for MedicationPackageContentItem.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationPackageContentItemExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_itemCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_itemReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the batch field in MedicationPackage
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationPackageBatchBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationPackageBatch {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Identifier assigned to batch**

 The assigned lot number of a batch of the specified product.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "lotNumber")]
    pub lot_number: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_lotNumber")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub lot_number_ext: Option<FieldExtension>,
    /** **When batch will expire**

 When this specific batch of product will expire.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "expirationDate")]
    pub expiration_date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_expirationDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub expiration_date_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MedicationPackageBatch {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationPackageBatchBuilder {
        MedicationPackageBatchBuilder::default()
    }
}
/** Base StructureDefinition for MedicationAdministration Resource

 **[MedicationAdministration](http://hl7.org/fhir/StructureDefinition/MedicationAdministration) v3.0.2**

 Administration of medication to a patient

 Describes the event of a patient consuming or otherwise being administered a medication.  This may be as simple as swallowing a tablet or it may be a long running infusion.  Related resources tie this event to the authorizing prescription, and the specific encounter between patient and health care practitioner.

 The WG will be updating the MedicationAdministration resource  to adjust each affected resource to align with the workflow pattern (see workflow.html). */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct MedicationAdministration(pub Box<MedicationAdministrationInner>);
/** Base StructureDefinition for MedicationAdministration Resource

 **[MedicationAdministration](http://hl7.org/fhir/StructureDefinition/MedicationAdministration) v3.0.2**

 Administration of medication to a patient

 Describes the event of a patient consuming or otherwise being administered a medication.  This may be as simple as swallowing a tablet or it may be a long running infusion.  Related resources tie this event to the authorizing prescription, and the specific encounter between patient and health care practitioner.

 The WG will be updating the MedicationAdministration resource  to adjust each affected resource to align with the workflow pattern (see workflow.html). */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationAdministrationBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct MedicationAdministrationInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "MedicationAdministration::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::MedicationAdministration", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **External identifier**

 External identifier - FHIR will generate its own internal identifiers (probably URLs) which do not need to be explicitly managed by the resource.  The identifier here is one that would be used by another non-FHIR system - for example an automated medication pump would provide a record each time it operated; an administration while the patient was off the ward might be made with a different system and entered after the event.  Particularly important if these records have to be updated.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Instantiates protocol or definition**

 A protocol, guideline, orderset or other definition that was adhered to in whole or in part by this event.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definition")]
    pub definition: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_definition")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub definition_ext: Vec<Option<FieldExtension>>,
    /** **Part of referenced event**

 A larger event of which this particular event is a component or step.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "partOf")]
    pub part_of: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_partOf")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub part_of_ext: Vec<Option<FieldExtension>>,
    /** **[MedicationAdministrationStatus](http://hl7.org/fhir/ValueSet/medication-admin-status); in-progress | on-hold | completed | entered-in-error | stopped | unknown**

 Will generally be set to show that the administration has been completed.  For some long running administrations such as infusions it is possible for an administration to be started but not completed or it may be paused while some other process is under way.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::MedicationAdministrationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[MedicationAdministrationCategory](http://hl7.org/fhir/ValueSet/medication-admin-category); Type of medication usage**

 Indicates the type of medication administration and where the medication is expected to be consumed or administered.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **What was administered**

 Identifies the medication that was administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.

 If only a code is specified, then it needs to be a code for a specific product. If more information is required, then the use of the medication resource is recommended.  For example if you require form or lot number, then you must reference the Medication resource. . */
    #[serde(flatten)]
    pub medication: MedicationAdministrationMedication,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub medication_ext: Option<MedicationAdministrationMedicationExtension>,
    /** **Who received medication**

 The person or animal or group receiving the medication.

 */
    #[serde(rename = "subject")]
    pub subject: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Encounter or Episode of Care administered as part of**

 The visit, admission or other contact between patient and health care provider the medication administration was performed as part of.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **Additional information to support administration**

 Additional information (for example, patient height and weight) that supports the administration of the medication.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "supportingInformation")]
    pub supporting_information: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_supportingInformation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub supporting_information_ext: Vec<Option<FieldExtension>>,
    /** **Start and end time of administration**

 A specific date/time or interval of time during which the administration took place (or did not take place, when the 'notGiven' attribute is true). For many administrations, such as swallowing a tablet the use of dateTime is more appropriate.

 */
    #[serde(flatten)]
    pub effective: MedicationAdministrationEffective,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub effective_ext: Option<MedicationAdministrationEffectiveExtension>,
    /** **Who administered substance**

 The individual who was responsible for giving the medication to the patient.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Vec<Option<MedicationAdministrationPerformer>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_performer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub performer_ext: Vec<Option<FieldExtension>>,
    /** **True if medication not administered**

 Set this to true if the record is saying that the medication was NOT administered.

 This element is labeled as a modifier because it indicates that a administration didn't happen. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "notGiven")]
    pub not_given: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_notGiven")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub not_given_ext: Option<FieldExtension>,
    /** **[MedicationAdministrationNegationReason](http://hl7.org/fhir/ValueSet/reason-medication-not-given-codes); Reason administration not performed**

 A code indicating why the administration was not performed.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonNotGiven")]
    pub reason_not_given: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonNotGiven")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_not_given_ext: Vec<Option<FieldExtension>>,
    /** **[MedicationAdministrationReason](http://hl7.org/fhir/ValueSet/reason-medication-given-codes); Reason administration performed**

 A code indicating why the medication was given.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonCode")]
    pub reason_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_code_ext: Vec<Option<FieldExtension>>,
    /** **Condition or Observation that supports why the medication was administered**

 Condition or observation that supports why the medication was administered.

 This is a reference to a condition that is the reason for the medication request.  If only a code exists, use reasonCode. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonReference")]
    pub reason_reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_reference_ext: Vec<Option<FieldExtension>>,
    /** **Request administration performed against**

 The original request, instruction or authority to perform the administration.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "prescription")]
    pub prescription: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_prescription")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub prescription_ext: Option<FieldExtension>,
    /** **Device used to administer**

 The device used in administering the medication to the patient.  For example, a particular infusion pump.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "device")]
    pub device: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_device")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub device_ext: Vec<Option<FieldExtension>>,
    /** **Information about the administration**

 Extra information about the medication administration that is not conveyed by the other attributes.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
    /** **Details of how medication was taken**

 Describes the medication dosage information details e.g. dose, rate, site, route, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dosage")]
    pub dosage: Option<MedicationAdministrationDosage>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_dosage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub dosage_ext: Option<FieldExtension>,
    /** **A list of events of interest in the lifecycle**

 A summary of the events of interest that have occurred, such as when the administration was verified.

 This may not include provenances for all versions of the request – only those deemed “relevant” or important. This SHALL NOT include the Provenance associated with this current version of the resource. (If that provenance is deemed to be a “relevant” change, it will need to be added as part of a later update. Until then, it can be queried directly as the Provenance that points to this version using _revinclude All Provenances should have some historical version of this Request as their subject. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "eventHistory")]
    pub event_history: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_eventHistory")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub event_history_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl MedicationAdministrationBuilder {
    #[doc = concat!("Finalize building ", "MedicationAdministration", ".")]
    pub fn build(self) -> Result<MedicationAdministration, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<MedicationAdministrationInner> for MedicationAdministration {
    fn from(inner: MedicationAdministrationInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for MedicationAdministration {
    type Target = MedicationAdministrationInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for MedicationAdministration {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl MedicationAdministration {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> MedicationAdministrationBuilder {
        MedicationAdministrationBuilder::default()
    }
}
impl MedicationAdministration {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::MedicationAdministration
    }
}
/// Choice of types for the medication[x] field in MedicationAdministration
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationAdministrationMedication {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "medicationCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "medicationReference")]
    Reference(Reference),
}
/// Extension value for MedicationAdministrationMedication.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationAdministrationMedicationExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_medicationCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_medicationReference")]
    Reference(FieldExtension),
}
/// Choice of types for the effective[x] field in MedicationAdministration
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationAdministrationEffective {
    /// Variant accepting the DateTime type.
    #[serde(rename = "effectiveDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "effectivePeriod")]
    Period(Period),
}
/// Extension value for MedicationAdministrationEffective.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationAdministrationEffectiveExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_effectiveDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_effectivePeriod")]
    Period(FieldExtension),
}
/// Sub-fields of the performer field in MedicationAdministration
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationAdministrationPerformerBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationAdministrationPerformer {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Individual who was performing**

 The device, practitioner, etc. who performed the action.

 */
    #[serde(rename = "actor")]
    pub actor: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_actor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub actor_ext: Option<FieldExtension>,
    /** **Organization organization was acting for**

 The organization the device or practitioner was acting on behalf of.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "onBehalfOf")]
    pub on_behalf_of: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_onBehalfOf")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub on_behalf_of_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MedicationAdministrationPerformer {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationAdministrationPerformerBuilder {
        MedicationAdministrationPerformerBuilder::default()
    }
}
/// Sub-fields of the dosage field in MedicationAdministration
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationAdministrationDosageBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationAdministrationDosage {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Free text dosage instructions e.g. SIG**

 Free text dosage can be used for cases where the dosage administered is too complex to code. When coded dosage is present, the free text dosage may still be present for display to humans.

The dosage instructions should reflect the dosage of the medication that was administered.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_text")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub text_ext: Option<FieldExtension>,
    /** **[MedicationAdministrationSite](http://hl7.org/fhir/ValueSet/approach-site-codes); Body site administered to**

 A coded specification of the anatomic site where the medication first entered the body.  For example, "left arm".

 If the use case requires attributes from the BodySite resource (e.g. to identify and track separately) then use the standard extension [body-site-instance](extension-body-site-instance.html).  May be a summary code, or a reference to a very precise definition of the location, or both. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "site")]
    pub site: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_site")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub site_ext: Option<FieldExtension>,
    /** **[RouteOfAdministration](http://hl7.org/fhir/ValueSet/route-codes); Path of substance into body**

 A code specifying the route or physiological path of administration of a therapeutic agent into or onto the patient.  For example, topical, intravenous, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "route")]
    pub route: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_route")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub route_ext: Option<FieldExtension>,
    /** **[MedicationAdministrationMethod](http://hl7.org/fhir/ValueSet/administration-method-codes); How drug was administered**

 A coded value indicating the method by which the medication is intended to be or was introduced into or on the body.  This attribute will most often NOT be populated.  It is most commonly used for injections.  For example, Slow Push, Deep IV.

 One of the reasons this attribute is not used often, is that the method is often pre-coordinated with the route and/or form of administration.  This means the codes used in route or form may pre-coordinate the method in the route code or the form code.  The implementation decision about what coding system to use for route or form code will determine how frequently the method code will be populated e.g. if route or form code pre-coordinate method code, then this attribute will not be populated often; if there is no pre-coordination then method code may  be used frequently. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "method")]
    pub method: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_method")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub method_ext: Option<FieldExtension>,
    /** **Amount of medication per dose**

 The amount of the medication given at one administration event.   Use this value when the administration is essentially an instantaneous event such as a swallowing a tablet or giving an injection.

 If the administration is not instantaneous (rate is present), this can be specified to convey the total amount administered over period of time of a single administration. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dose")]
    pub dose: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_dose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub dose_ext: Option<FieldExtension>,
    /** **Dose quantity per unit of time**

 Identifies the speed with which the medication was or will be introduced into the patient.  Typically the rate for an infusion e.g. 100 ml per 1 hour or 100 ml/hr.  May also be expressed as a rate per unit of time e.g. 500 ml per 2 hours.  Other examples:  200 mcg/min or 200 mcg/1 minute; 1 liter/8 hours.

 If the rate changes over time, and you want to capture this in MedicationAdministration, then each change should be captured as a distinct MedicationAdministration, with a specific MedicationAdministration.dosage.rate, and the date time when the rate change occurred. Typically, the MedicationAdministration.dosage.rate element is not used to convey an average rate. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub rate: Option<MedicationAdministrationDosageRate>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub rate_ext: Option<MedicationAdministrationDosageRateExtension>,
}
#[cfg(feature = "builders")]
impl MedicationAdministrationDosage {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationAdministrationDosageBuilder {
        MedicationAdministrationDosageBuilder::default()
    }
}
/// Choice of types for the rate[x] field in MedicationAdministrationDosage
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationAdministrationDosageRate {
    /// Variant accepting the Ratio type.
    #[serde(rename = "rateRatio")]
    Ratio(Ratio),
    /// Variant accepting the Quantity type.
    #[serde(rename = "rateQuantity")]
    Quantity(Quantity),
}
/// Extension value for MedicationAdministrationDosageRate.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationAdministrationDosageRateExtension {
    /// Variant accepting the Ratio extension.
    #[serde(rename = "_rateRatio")]
    Ratio(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_rateQuantity")]
    Quantity(FieldExtension),
}
/** Base StructureDefinition for MedicationDispense Resource

 **[MedicationDispense](http://hl7.org/fhir/StructureDefinition/MedicationDispense) v3.0.2**

 Dispensing a medication to a named patient

 Indicates that a medication product is to be or has been dispensed for a named person/patient.  This includes a description of the medication product (supply) provided and the instructions for administering the medication.  The medication dispense is the result of a pharmacy system responding to a medication order.

 The WG will be updating the MedicationDispense resource  to adjust each affected resource to align with the workflow pattern (see workflow.html). */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct MedicationDispense(pub Box<MedicationDispenseInner>);
/** Base StructureDefinition for MedicationDispense Resource

 **[MedicationDispense](http://hl7.org/fhir/StructureDefinition/MedicationDispense) v3.0.2**

 Dispensing a medication to a named patient

 Indicates that a medication product is to be or has been dispensed for a named person/patient.  This includes a description of the medication product (supply) provided and the instructions for administering the medication.  The medication dispense is the result of a pharmacy system responding to a medication order.

 The WG will be updating the MedicationDispense resource  to adjust each affected resource to align with the workflow pattern (see workflow.html). */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationDispenseBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct MedicationDispenseInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "MedicationDispense::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::MedicationDispense", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **External identifier**

 Identifier assigned by the dispensing facility - this is an identifier assigned outside FHIR.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Event that dispense is part of**

 The procedure that the dispense is done because of.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "partOf")]
    pub part_of: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_partOf")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub part_of_ext: Vec<Option<FieldExtension>>,
    /** **[MedicationDispenseStatus](http://hl7.org/fhir/ValueSet/medication-dispense-status); preparation | in-progress | on-hold | completed | entered-in-error | stopped**

 A code specifying the state of the set of dispense events.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<codes::MedicationDispenseStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[MedicationDispenseCategory](http://hl7.org/fhir/ValueSet/medication-dispense-category); Type of medication dispense**

 Indicates type of medication dispense and where the medication is expected to be consumed or administered.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **What medication was supplied**

 Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.

 If only a code is specified, then it needs to be a code for a specific product. If more information is required, then the use of the medication resource is recommended.  For example if you require form or lot number, then you must reference the Medication resource. . */
    #[serde(flatten)]
    pub medication: MedicationDispenseMedication,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub medication_ext: Option<MedicationDispenseMedicationExtension>,
    /** **Who the dispense is for**

 A link to a resource representing the person or the group to whom the medication will be given.

 SubstanceAdministration->subject->Patient. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Encounter / Episode associated with event**

 The encounter or episode of care that establishes the context for this event.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **Information that supports the dispensing of the medication**

 Additional information that supports the medication being dispensed.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "supportingInformation")]
    pub supporting_information: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_supportingInformation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub supporting_information_ext: Vec<Option<FieldExtension>>,
    /** **Who performed event**

 Indicates who or what performed the event.  It should be assumed that the performer is the dispenser of the medication.

 The performer will be reviewed as part of STU4. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Vec<Option<MedicationDispensePerformer>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_performer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub performer_ext: Vec<Option<FieldExtension>>,
    /** **Medication order that authorizes the dispense**

 Indicates the medication order that is being dispensed against.

 Maps to basedOn in Event logical model. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authorizingPrescription")]
    pub authorizing_prescription: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_authorizingPrescription")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub authorizing_prescription_ext: Vec<Option<FieldExtension>>,
    /** **[MedicationDispenseType](http://hl7.org/fhir/ValueSet/v3-ActPharmacySupplyType); Trial fill, partial fill, emergency fill, etc.**

 Indicates the type of dispensing event that is performed. For example, Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Amount dispensed**

 The amount of medication that has been dispensed. Includes unit of measure.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_quantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<FieldExtension>,
    /** **Amount of medication expressed as a timing amount**

 The amount of medication expressed as a timing amount.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "daysSupply")]
    pub days_supply: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_daysSupply")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub days_supply_ext: Option<FieldExtension>,
    /** **When product was packaged and reviewed**

 The time when the dispensed product was packaged and reviewed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "whenPrepared")]
    pub when_prepared: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_whenPrepared")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub when_prepared_ext: Option<FieldExtension>,
    /** **When product was given out**

 The time the dispensed product was provided to the patient or their representative.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "whenHandedOver")]
    pub when_handed_over: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_whenHandedOver")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub when_handed_over_ext: Option<FieldExtension>,
    /** **Where the medication was sent**

 Identification of the facility/location where the medication was shipped to, as part of the dispense event.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "destination")]
    pub destination: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_destination")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub destination_ext: Option<FieldExtension>,
    /** **Who collected the medication**

 Identifies the person who picked up the medication.  This will usually be a patient or their caregiver, but some cases exist where it can be a healthcare professional.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "receiver")]
    pub receiver: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_receiver")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub receiver_ext: Vec<Option<FieldExtension>>,
    /** **Information about the dispense**

 Extra information about the dispense that could not be conveyed in the other attributes.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
    /** **How the medication is to be used by the patient or administered by the caregiver**

 Indicates how the medication is to be used by the patient.

 When the dose or rate is intended to change over the entire administration period (e.g. Tapering dose prescriptions), multiple instances of dosage instructions will need to be supplied to convey the different doses/rates.
The pharmacist reviews the medication order prior to dispense and updates the dosageInstruction based on the actual product being dispensed. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dosageInstruction")]
    pub dosage_instruction: Vec<Option<Dosage>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_dosageInstruction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub dosage_instruction_ext: Vec<Option<FieldExtension>>,
    /** **Whether a substitution was performed on the dispense**

 Indicates whether or not substitution was made as part of the dispense.  In some cases substitution will be expected but does not happen, in other cases substitution is not expected but does happen.  This block explains what substitution did or did not happen and why.  If nothing is specified, substitution was not done.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "substitution")]
    pub substitution: Option<MedicationDispenseSubstitution>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_substitution")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub substitution_ext: Option<FieldExtension>,
    /** **Clinical issue with action**

 Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, duplicate therapy, dosage alert etc.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "detectedIssue")]
    pub detected_issue: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_detectedIssue")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub detected_issue_ext: Vec<Option<FieldExtension>>,
    /** **Whether the dispense was or was not performed**

 True if the dispense was not performed for some reason.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "notDone")]
    pub not_done: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_notDone")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub not_done_ext: Option<FieldExtension>,
    /** **Why a dispense was not performed**

 Indicates the reason why a dispense was not performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub not_done_reason: Option<MedicationDispenseNotDoneReason>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub not_done_reason_ext: Option<MedicationDispenseNotDoneReasonExtension>,
    /** **A list of releveant lifecycle events**

 A summary of the events of interest that have occurred, such as when the dispense was verified.

 This may not include provenances for all versions of the request – only those deemed “relevant” or important. This SHALL NOT include the Provenance associated with this current version of the resource. (If that provenance is deemed to be a “relevant” change, it will need to be added as part of a later update. Until then, it can be queried directly as the Provenance that points to this version using _revinclude All Provenances should have some historical version of this Request as their subject.). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "eventHistory")]
    pub event_history: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_eventHistory")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub event_history_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl MedicationDispenseBuilder {
    #[doc = concat!("Finalize building ", "MedicationDispense", ".")]
    pub fn build(self) -> Result<MedicationDispense, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<MedicationDispenseInner> for MedicationDispense {
    fn from(inner: MedicationDispenseInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for MedicationDispense {
    type Target = MedicationDispenseInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for MedicationDispense {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl MedicationDispense {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> MedicationDispenseBuilder {
        MedicationDispenseBuilder::default()
    }
}
impl MedicationDispense {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::MedicationDispense
    }
}
/// Choice of types for the medication[x] field in MedicationDispense
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationDispenseMedication {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "medicationCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "medicationReference")]
    Reference(Reference),
}
/// Extension value for MedicationDispenseMedication.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationDispenseMedicationExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_medicationCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_medicationReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the performer field in MedicationDispense
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationDispensePerformerBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationDispensePerformer {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Individual who was performing**

 The device, practitioner, etc. who performed the action.  It should be assumed that the actor is the dispenser of the medication.

 */
    #[serde(rename = "actor")]
    pub actor: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_actor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub actor_ext: Option<FieldExtension>,
    /** **Organization organization was acting for**

 The organization the device or practitioner was acting on behalf of.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "onBehalfOf")]
    pub on_behalf_of: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_onBehalfOf")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub on_behalf_of_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MedicationDispensePerformer {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationDispensePerformerBuilder {
        MedicationDispensePerformerBuilder::default()
    }
}
/// Sub-fields of the substitution field in MedicationDispense
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationDispenseSubstitutionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationDispenseSubstitution {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Whether a substitution was or was not performed on the dispense**

 True if the dispenser dispensed a different drug or product from what was prescribed.

 */
    #[serde(rename = "wasSubstituted")]
    pub was_substituted: bool,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_wasSubstituted")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub was_substituted_ext: Option<FieldExtension>,
    /** **[MedicationIntendedSubstitutionType](http://hl7.org/fhir/ValueSet/v3-ActSubstanceAdminSubstitutionCode); Code signifying whether a different drug was dispensed from what was prescribed**

 A code signifying whether a different drug was dispensed from what was prescribed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[MedicationIntendedSubstitutionReason](http://hl7.org/fhir/ValueSet/v3-SubstanceAdminSubstitutionReason); Why was substitution made**

 Indicates the reason for the substitution of (or lack of substitution) from what was prescribed.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reason")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_ext: Vec<Option<FieldExtension>>,
    /** **Who is responsible for the substitution**

 The person or organization that has primary responsibility for the substitution.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "responsibleParty")]
    pub responsible_party: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_responsibleParty")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub responsible_party_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl MedicationDispenseSubstitution {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationDispenseSubstitutionBuilder {
        MedicationDispenseSubstitutionBuilder::default()
    }
}
/// Choice of types for the notDoneReason[x] field in MedicationDispense
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationDispenseNotDoneReason {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "notDoneReasonCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "notDoneReasonReference")]
    Reference(Reference),
}
/// Extension value for MedicationDispenseNotDoneReason.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationDispenseNotDoneReasonExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_notDoneReasonCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_notDoneReasonReference")]
    Reference(FieldExtension),
}
/** Base StructureDefinition for MedicationRequest Resource

 **[MedicationRequest](http://hl7.org/fhir/StructureDefinition/MedicationRequest) v3.0.2**

 Ordering of medication for patient or group

 An order or request for both supply of the medication and the instructions for administration of the medication to a patient. The resource is called "MedicationRequest" rather than "MedicationPrescription" or "MedicationOrder" to generalize the use across inpatient and outpatient settings, including care plans, etc., and to harmonize with workflow patterns.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct MedicationRequest(pub Box<MedicationRequestInner>);
/** Base StructureDefinition for MedicationRequest Resource

 **[MedicationRequest](http://hl7.org/fhir/StructureDefinition/MedicationRequest) v3.0.2**

 Ordering of medication for patient or group

 An order or request for both supply of the medication and the instructions for administration of the medication to a patient. The resource is called "MedicationRequest" rather than "MedicationPrescription" or "MedicationOrder" to generalize the use across inpatient and outpatient settings, including care plans, etc., and to harmonize with workflow patterns.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationRequestBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct MedicationRequestInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "MedicationRequest::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::MedicationRequest", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **External ids for this request**

 This records identifiers associated with this medication request that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. For example a re-imbursement system might issue its own id for each prescription that is created.  This is particularly important where FHIR only provides part of an entire workflow process where records must be tracked through an entire system.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Protocol or definition**

 Protocol or definition followed by this request.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definition")]
    pub definition: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_definition")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub definition_ext: Vec<Option<FieldExtension>>,
    /** **What request fulfills**

 A plan or request that is fulfilled in whole or in part by this medication request.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basedOn")]
    pub based_on: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_basedOn")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub based_on_ext: Vec<Option<FieldExtension>>,
    /** **Composite request this is part of**

 A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "groupIdentifier")]
    pub group_identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_groupIdentifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub group_identifier_ext: Option<FieldExtension>,
    /** **[MedicationRequestStatus](http://hl7.org/fhir/ValueSet/medication-request-status); active | on-hold | cancelled | completed | entered-in-error | stopped | draft | unknown**

 A code specifying the current state of the order.  Generally this will be active or completed state.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<codes::MedicationRequestStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[MedicationRequestIntent](http://hl7.org/fhir/ValueSet/medication-request-intent); proposal | plan | order | instance-order**

 Whether the request is a proposal, plan, or an original order.

 It is expected that the type of requester will be restricted for different stages of a MedicationRequest.  For example, Proposals can be created by a patient, relatedPerson, Practitioner or Device.  Plans can be created by Practitioners, Patients, RelatedPersons and Devices.  Original orders can be created by a Practitioner only.

An instance-order is an instantiation of a request or order and may be used to populate Medication Administration Record.

This element is labeled as a modifier because the intent alters when and how the resource is actually applicable. */
    #[serde(rename = "intent")]
    pub intent: codes::MedicationRequestIntent,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_intent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub intent_ext: Option<FieldExtension>,
    /** **[MedicationRequestCategory](http://hl7.org/fhir/ValueSet/medication-request-category); Type of medication usage**

 Indicates the type of medication order and where the medication is expected to be consumed or administered.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[MedicationRequestPriority](http://hl7.org/fhir/ValueSet/medication-request-priority); routine | urgent | stat | asap**

 Indicates how quickly the Medication Request should be addressed with respect to other requests.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "priority")]
    pub priority: Option<codes::MedicationRequestPriority>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_priority")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub priority_ext: Option<FieldExtension>,
    /** **Medication to be taken**

 Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.

 If only a code is specified, then it needs to be a code for a specific product. If more information is required, then the use of the medication resource is recommended.  For example, if you require form or lot number or if the medication is compounded or extemporaneously prepared, then you must reference the Medication resource. . */
    #[serde(flatten)]
    pub medication: MedicationRequestMedication,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub medication_ext: Option<MedicationRequestMedicationExtension>,
    /** **Who or group medication request is for**

 A link to a resource representing the person or set of individuals to whom the medication will be given.

 The subject on a medication request is mandatory.  For the secondary use case where the actual subject is not provided, there still must be an anonymized subject specified. */
    #[serde(rename = "subject")]
    pub subject: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Created during encounter/admission/stay**

 A link to an encounter, or episode of care, that identifies the particular occurrence or set occurrences of contact between patient and health care provider.

 SubstanceAdministration->component->EncounterEvent. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **Information to support ordering of the medication**

 Include additional information (for example, patient height and weight) that supports the ordering of the medication.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "supportingInformation")]
    pub supporting_information: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_supportingInformation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub supporting_information_ext: Vec<Option<FieldExtension>>,
    /** **When request was initially authored**

 The date (and perhaps time) when the prescription was initially written or authored on.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authoredOn")]
    pub authored_on: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_authoredOn")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub authored_on_ext: Option<FieldExtension>,
    /** **Who/What requested the Request**

 The individual, organization or device that initiated the request and has responsibility for its activation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requester")]
    pub requester: Option<MedicationRequestRequester>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requester")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub requester_ext: Option<FieldExtension>,
    /** **Person who entered the request**

 The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recorder")]
    pub recorder: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_recorder")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub recorder_ext: Option<FieldExtension>,
    /** **[MedicationRequestReason](http://hl7.org/fhir/ValueSet/condition-code); Reason or indication for writing the prescription**

 The reason or the indication for ordering the medication.

 This could be a diagnosis code. If a full condition record exists or additional detail is needed, use reasonReference. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonCode")]
    pub reason_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_code_ext: Vec<Option<FieldExtension>>,
    /** **Condition or Observation that supports why the prescription is being written**

 Condition or observation that supports why the medication was ordered.

 This is a reference to a condition or observation that is the reason for the medication order.  If only a code exists, use reasonCode. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonReference")]
    pub reason_reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_reference_ext: Vec<Option<FieldExtension>>,
    /** **Information about the prescription**

 Extra information about the prescription that could not be conveyed by the other attributes.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
    /** **How the medication should be taken**

 Indicates how the medication is to be used by the patient.

 There are examples where a medication request may include the option of an oral dose or an Intravenous or Intramuscular dose.  For example, "Ondansetron 8mg orally or IV twice a day as needed for nausea" or "Compazine® (prochlorperazine) 5-10mg PO or 25mg PR bid prn nausea or vomiting".  In these cases, two medication requests would be created that could be grouped together.  The decision on which dose and route of administration to use is based on the patient's condition at the time the dose is needed. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dosageInstruction")]
    pub dosage_instruction: Vec<Option<Dosage>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_dosageInstruction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub dosage_instruction_ext: Vec<Option<FieldExtension>>,
    /** **Medication supply authorization**

 Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order).  Note that this information is not always sent with the order.  There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dispenseRequest")]
    pub dispense_request: Option<MedicationRequestDispenseRequest>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_dispenseRequest")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub dispense_request_ext: Option<FieldExtension>,
    /** **Any restrictions on medication substitution**

 Indicates whether or not substitution can or should be part of the dispense. In some cases substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "substitution")]
    pub substitution: Option<MedicationRequestSubstitution>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_substitution")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub substitution_ext: Option<FieldExtension>,
    /** **An order/prescription that is being replaced**

 A link to a resource representing an earlier order related order or prescription.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "priorPrescription")]
    pub prior_prescription: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_priorPrescription")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub prior_prescription_ext: Option<FieldExtension>,
    /** **Clinical Issue with action**

 Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, duplicate therapy, dosage alert etc.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "detectedIssue")]
    pub detected_issue: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_detectedIssue")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub detected_issue_ext: Vec<Option<FieldExtension>>,
    /** **A list of events of interest in the lifecycle**

 Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.

 This may not include provenances for all versions of the request – only those deemed “relevant” or important. This SHALL NOT include the Provenance associated with this current version of the resource. (If that provenance is deemed to be a “relevant” change, it will need to be added as part of a later update. Until then, it can be queried directly as the Provenance that points to this version using _revinclude All Provenances should have some historical version of this Request as their subject.). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "eventHistory")]
    pub event_history: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_eventHistory")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub event_history_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl MedicationRequestBuilder {
    #[doc = concat!("Finalize building ", "MedicationRequest", ".")]
    pub fn build(self) -> Result<MedicationRequest, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<MedicationRequestInner> for MedicationRequest {
    fn from(inner: MedicationRequestInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for MedicationRequest {
    type Target = MedicationRequestInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for MedicationRequest {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl MedicationRequest {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> MedicationRequestBuilder {
        MedicationRequestBuilder::default()
    }
}
impl MedicationRequest {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::MedicationRequest
    }
}
/// Choice of types for the medication[x] field in MedicationRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationRequestMedication {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "medicationCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "medicationReference")]
    Reference(Reference),
}
/// Extension value for MedicationRequestMedication.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationRequestMedicationExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_medicationCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_medicationReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the requester field in MedicationRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationRequestRequesterBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationRequestRequester {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Who ordered the initial medication(s)**

 The healthcare professional responsible for authorizing the initial prescription.

 It is expected that the type of requester will be restricted for different stages of a MedicationRequest.  For example, Proposals can be created by a patient, relatedPerson, Practitioner or Device.  Plans can be created by Practitioners, Patients, RelatedPersons and Devices.  Original orders can be created by a Practitioner only. */
    #[serde(rename = "agent")]
    pub agent: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_agent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub agent_ext: Option<FieldExtension>,
    /** **Organization agent is acting for**

 The organization the device or practitioner was acting on behalf of.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "onBehalfOf")]
    pub on_behalf_of: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_onBehalfOf")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub on_behalf_of_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MedicationRequestRequester {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationRequestRequesterBuilder {
        MedicationRequestRequesterBuilder::default()
    }
}
/// Sub-fields of the dispenseRequest field in MedicationRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationRequestDispenseRequestBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationRequestDispenseRequest {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Time period supply is authorized for**

 This indicates the validity period of a prescription (stale dating the Prescription).

 It reflects the prescribers' perspective for the validity of the prescription. Dispenses must not be made against the prescription outside of this period. The lower-bound of the Dispensing Window signifies the earliest date that the prescription can be filled for the first time. If an upper-bound is not specified then the Prescription is open-ended or will default to a stale-date based on regulations. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "validityPeriod")]
    pub validity_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_validityPeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub validity_period_ext: Option<FieldExtension>,
    /** **Number of refills authorized**

 An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets.

 If displaying "number of authorized fills", add 1 to this number. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "numberOfRepeatsAllowed")]
    pub number_of_repeats_allowed: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_numberOfRepeatsAllowed")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub number_of_repeats_allowed_ext: Option<FieldExtension>,
    /** **Amount of medication to supply per dispense**

 The amount that is to be dispensed for one fill.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_quantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<FieldExtension>,
    /** **Number of days supply per dispense**

 Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.

 In some situations, this attribute may be used instead of quantity to identify the amount supplied by how long it is expected to last, rather than the physical quantity issued, e.g. 90 days supply of medication (based on an ordered dosage) When possible, it is always better to specify quantity, as this tends to be more precise. expectedSupplyDuration will always be an estimate that can be influenced by external factors. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "expectedSupplyDuration")]
    pub expected_supply_duration: Option<Duration>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_expectedSupplyDuration")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub expected_supply_duration_ext: Option<FieldExtension>,
    /** **Intended dispenser**

 Indicates the intended dispensing Organization specified by the prescriber.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_performer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub performer_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MedicationRequestDispenseRequest {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationRequestDispenseRequestBuilder {
        MedicationRequestDispenseRequestBuilder::default()
    }
}
/// Sub-fields of the substitution field in MedicationRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationRequestSubstitutionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MedicationRequestSubstitution {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Whether substitution is allowed or not**

 True if the prescriber allows a different drug to be dispensed from what was prescribed.

 This element is labeled as a modifer because whether substitution is allow or not cannot be ignored. */
    #[serde(rename = "allowed")]
    pub allowed: bool,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_allowed")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub allowed_ext: Option<FieldExtension>,
    /** **[MedicationIntendedSubstitutionReason](http://hl7.org/fhir/ValueSet/v3-SubstanceAdminSubstitutionReason); Why should (not) substitution be made**

 Indicates the reason for the substitution, or why substitution must or must not be performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reason_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MedicationRequestSubstitution {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MedicationRequestSubstitutionBuilder {
        MedicationRequestSubstitutionBuilder::default()
    }
}
/** Base StructureDefinition for MedicationStatement Resource

 **[MedicationStatement](http://hl7.org/fhir/StructureDefinition/MedicationStatement) v3.0.2**

 Record of medication being taken by a patient

 A record of a medication that is being consumed by a patient.   A MedicationStatement may indicate that the patient may be taking the medication now, or has taken the medication in the past or will be taking the medication in the future.  The source of this information can be the patient, significant other (such as a family member or spouse), or a clinician.  A common scenario where this information is captured is during the history taking process during a patient visit or stay.   The medication information may come from sources such as the patient's memory, from a prescription bottle,  or from a list of medications the patient, clinician or other party maintains

The primary difference between a medication statement and a medication administration is that the medication administration has complete administration information and is based on actual administration information from the person who administered the medication.  A medication statement is often, if not always, less specific.  There is no required date/time when the medication was administered, in fact we only know that a source has reported the patient is taking this medication, where details such as time, quantity, or rate or even medication product may be incomplete or missing or less precise.  As stated earlier, the medication statement information may come from the patient's memory, from a prescription bottle or from a list of medications the patient, clinician or other party maintains.  Medication administration is more formal and is not missing detailed information.

 When interpreting a medicationStatement, the value of the status and NotTaken needed to be considered:
MedicationStatement.status + MedicationStatement.wasNotTaken
Status=Active + NotTaken=T = Not currently taking
Status=Completed + NotTaken=T = Not taken in the past
Status=Intended + NotTaken=T = No intention of taking
Status=Active + NotTaken=F = Taking, but not as prescribed
Status=Active + NotTaken=F = Taking
Status=Intended +NotTaken= F = Will be taking (not started)
Status=Completed + NotTaken=F = Taken in past
Status=In Error + NotTaken=N/A = In Error. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct MedicationStatement(pub Box<MedicationStatementInner>);
/** Base StructureDefinition for MedicationStatement Resource

 **[MedicationStatement](http://hl7.org/fhir/StructureDefinition/MedicationStatement) v3.0.2**

 Record of medication being taken by a patient

 A record of a medication that is being consumed by a patient.   A MedicationStatement may indicate that the patient may be taking the medication now, or has taken the medication in the past or will be taking the medication in the future.  The source of this information can be the patient, significant other (such as a family member or spouse), or a clinician.  A common scenario where this information is captured is during the history taking process during a patient visit or stay.   The medication information may come from sources such as the patient's memory, from a prescription bottle,  or from a list of medications the patient, clinician or other party maintains

The primary difference between a medication statement and a medication administration is that the medication administration has complete administration information and is based on actual administration information from the person who administered the medication.  A medication statement is often, if not always, less specific.  There is no required date/time when the medication was administered, in fact we only know that a source has reported the patient is taking this medication, where details such as time, quantity, or rate or even medication product may be incomplete or missing or less precise.  As stated earlier, the medication statement information may come from the patient's memory, from a prescription bottle or from a list of medications the patient, clinician or other party maintains.  Medication administration is more formal and is not missing detailed information.

 When interpreting a medicationStatement, the value of the status and NotTaken needed to be considered:
MedicationStatement.status + MedicationStatement.wasNotTaken
Status=Active + NotTaken=T = Not currently taking
Status=Completed + NotTaken=T = Not taken in the past
Status=Intended + NotTaken=T = No intention of taking
Status=Active + NotTaken=F = Taking, but not as prescribed
Status=Active + NotTaken=F = Taking
Status=Intended +NotTaken= F = Will be taking (not started)
Status=Completed + NotTaken=F = Taken in past
Status=In Error + NotTaken=N/A = In Error. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MedicationStatementBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct MedicationStatementInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "MedicationStatement::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::MedicationStatement", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **External identifier**

 External identifier - FHIR will generate its own internal identifiers (probably URLs) which do not need to be explicitly managed by the resource.  The identifier here is one that would be used by another non-FHIR system - for example an automated medication pump would provide a record each time it operated; an administration while the patient was off the ward might be made with a different system and entered after the event.  Particularly important if these records have to be updated.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Fulfils plan, proposal or order**

 A plan, proposal or order that is fulfilled in whole or in part by this event.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basedOn")]
    pub based_on: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_basedOn")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub based_on_ext: Vec<Option<FieldExtension>>,
    /** **Part of referenced event**

 A larger event of which this particular event is a component or step.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "partOf")]
    pub part_of: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_partOf")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub part_of_ext: Vec<Option<FieldExtension>>,
    /** **Encounter / Episode associated with MedicationStatement**

 The encounter or episode of care that establishes the context for this MedicationStatement.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **[MedicationStatementStatus](http://hl7.org/fhir/ValueSet/medication-statement-status); active | completed | entered-in-error | intended | stopped | on-hold**

 A code representing the patient or other source's judgment about the state of the medication used that this statement is about.  Generally this will be active or completed.

 MedicationStatement is a statement at a point in time.  The status is only representative at the point when it was asserted.  The value set for MedicationStatement.status contains codes that assert the status of the use of the medication by the patient (for example, stopped or on hold) as well as codes that assert the status of the medication statement itself (for example, entered in error).

This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::MedicationStatementStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[MedicationStatementCategory](http://hl7.org/fhir/ValueSet/medication-statement-category); Type of medication usage**

 Indicates where type of medication statement and where the medication is expected to be consumed or administered.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **What medication was taken**

 Identifies the medication being administered. This is either a link to a resource representing the details of the medication or a simple attribute carrying a code that identifies the medication from a known list of medications.

 If only a code is specified, then it needs to be a code for a specific product. If more information is required, then the use of the medication resource is recommended.  For example if you require form or lot number, then you must reference the Medication resource. . */
    #[serde(flatten)]
    pub medication: MedicationStatementMedication,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub medication_ext: Option<MedicationStatementMedicationExtension>,
    /** **The date/time or interval when the medication was taken**

 The interval of time during which it is being asserted that the patient was taking the medication (or was not taking, when the wasNotGiven element is true).

 This attribute reflects the period over which the patient consumed the medication and is expected to be populated on the majority of Medication Statements. If the medication is still being taken at the time the statement is recorded, the "end" date will be omitted. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub effective: Option<MedicationStatementEffective>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub effective_ext: Option<MedicationStatementEffectiveExtension>,
    /** **When the statement was asserted?**

 The date when the medication statement was asserted by the information source.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dateAsserted")]
    pub date_asserted: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_dateAsserted")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_asserted_ext: Option<FieldExtension>,
    /** **Person or organization that provided the information about the taking of this medication**

 The person or organization that provided the information about the taking of this medication. Note: Use derivedFrom when a MedicationStatement is derived from other resources, e.g Claim or MedicationRequest.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "informationSource")]
    pub information_source: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_informationSource")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub information_source_ext: Option<FieldExtension>,
    /** **Who is/was taking  the medication**

 The person, animal or group who is/was taking the medication.

 */
    #[serde(rename = "subject")]
    pub subject: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Additional supporting information**

 Allows linking the MedicationStatement to the underlying MedicationRequest, or to other information that supports or is used to derive the MedicationStatement.

 Likely references would be to MedicationRequest, MedicationDispense, Claim, Observation or QuestionnaireAnswers.  The most common use cases for deriving a MedicationStatement comes from creating a MedicationStatement from a MedicationRequest or from a lab observation or a claim.  it should be noted that the amount of information that is available varies from the type resource that you derive the MedicationStatement from. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "derivedFrom")]
    pub derived_from: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_derivedFrom")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub derived_from_ext: Vec<Option<FieldExtension>>,
    /** **[MedicationStatementTaken](http://hl7.org/fhir/ValueSet/medication-statement-taken); y | n | unk | na**

 Indicator of the certainty of whether the medication was taken by the patient.

 This element is labeled as a modifier because it indicates that the medication was not taken. */
    #[serde(rename = "taken")]
    pub taken: codes::MedicationStatementTaken,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_taken")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub taken_ext: Option<FieldExtension>,
    /** **[MedicationStatementNotTakenReason](http://hl7.org/fhir/ValueSet/reason-medication-not-taken-codes); True if asserting medication was not given**

 A code indicating why the medication was not taken.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonNotTaken")]
    pub reason_not_taken: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonNotTaken")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_not_taken_ext: Vec<Option<FieldExtension>>,
    /** **[MedicationReason](http://hl7.org/fhir/ValueSet/condition-code); Reason for why the medication is being/was taken**

 A reason for why the medication is being/was taken.

 This could be a diagnosis code. If a full condition record exists or additional detail is needed, use reasonForUseReference. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonCode")]
    pub reason_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_code_ext: Vec<Option<FieldExtension>>,
    /** **Condition or observation that supports why the medication is being/was taken**

 Condition or observation that supports why the medication is being/was taken.

 This is a reference to a condition that is the reason why the medication is being/was taken.  If only a code exists, use reasonForUseCode. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonReference")]
    pub reason_reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_reference_ext: Vec<Option<FieldExtension>>,
    /** **Further information about the statement**

 Provides extra information about the medication statement that is not conveyed by the other attributes.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
    /** **Details of how medication is/was taken or should be taken**

 Indicates how the medication is/was or should be taken by the patient.

 The dates included in the dosage on a Medication Statement reflect the dates for a given dose.  For example, "from November 1, 2016 to November 3, 2016, take one tablet daily and from November 4, 2016 to November 7, 2016, take two tablets daily."  It is expected that this specificity may only be populated where the patient brings in their labeled container or where the Medication Statement is derived from a MedicationRequest. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dosage")]
    pub dosage: Vec<Option<Dosage>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_dosage")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub dosage_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl MedicationStatementBuilder {
    #[doc = concat!("Finalize building ", "MedicationStatement", ".")]
    pub fn build(self) -> Result<MedicationStatement, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<MedicationStatementInner> for MedicationStatement {
    fn from(inner: MedicationStatementInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for MedicationStatement {
    type Target = MedicationStatementInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for MedicationStatement {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl MedicationStatement {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> MedicationStatementBuilder {
        MedicationStatementBuilder::default()
    }
}
impl MedicationStatement {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::MedicationStatement
    }
}
/// Choice of types for the medication[x] field in MedicationStatement
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationStatementMedication {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "medicationCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "medicationReference")]
    Reference(Reference),
}
/// Extension value for MedicationStatementMedication.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationStatementMedicationExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_medicationCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_medicationReference")]
    Reference(FieldExtension),
}
/// Choice of types for the effective[x] field in MedicationStatement
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationStatementEffective {
    /// Variant accepting the DateTime type.
    #[serde(rename = "effectiveDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "effectivePeriod")]
    Period(Period),
}
/// Extension value for MedicationStatementEffective.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum MedicationStatementEffectiveExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_effectiveDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_effectivePeriod")]
    Period(FieldExtension),
}
/** Base StructureDefinition for MessageDefinition Resource

 **[MessageDefinition](http://hl7.org/fhir/StructureDefinition/MessageDefinition) v3.0.2**

 A resource that defines a type of message that can be exchanged between systems

 Defines the characteristics of a message that can be shared between systems, including the type of event that initiates the message, the content to be transmitted and what response(s), if any, are permitted.

 This would be a MIF-level artifact. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct MessageDefinition(pub Box<MessageDefinitionInner>);
/** Base StructureDefinition for MessageDefinition Resource

 **[MessageDefinition](http://hl7.org/fhir/StructureDefinition/MessageDefinition) v3.0.2**

 A resource that defines a type of message that can be exchanged between systems

 Defines the characteristics of a message that can be shared between systems, including the type of event that initiates the message, the content to be transmitted and what response(s), if any, are permitted.

 This would be a MIF-level artifact. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MessageDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct MessageDefinitionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "MessageDefinition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::MessageDefinition", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical URI to reference this message definition (globally unique)**

 An absolute URI that is used to identify this message definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this message definition is (or will be) published. The URL SHOULD include the major version of the message definition. For more information see [Technical and Business Versions](resource.html#versions).

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred.  Multiple instances may share the same url if they have a distinct version. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "url")]
    pub url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Additional identifier for the message definition**

 A formal identifier that is used to identify this message definition when it is represented in other formats, or referenced in a specification, model, design or an instance.

 Typically, this is used for identifiers that can go in an HL7 V3 II (instance identifier) data type, e.g., to identify this message definition outside of FHIR, where it is not possible to use the logical URI. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **Business version of the message definition**

 The identifier that is used to identify this version of the message definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the message definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.

 There may be different message definition instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a refrence to a particular business version of the message definition with the format [url]|[version]. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Name for this message definition (computer friendly)**

 A natural language name identifying the message definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.

 The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure that it is computable friendly. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Name for this message definition (human friendly)**

 A short, descriptive, user-friendly title for the message definition.

 This name does not need to be machine-processing friendly and may contain punctuation, white-space, etc. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this message definition. Enables tracking the life-cycle of the content.

 Allows filtering of message definitions that are appropriate for use vs. not.
This is labeled as "Is Modifier" because applications should not use a retired message definition without due consideration. */
    #[serde(rename = "status")]
    pub status: codes::PublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **For testing purposes, not real usage**

 A boolean value to indicate that this message definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of message definition that are appropriate for use vs. not. This is labeled as "Is Modifier" because applications should not use an experimental message definition in production. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "experimental")]
    pub experimental: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_experimental")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub experimental_ext: Option<FieldExtension>,
    /** **Date this was last changed**

 The date  (and optionally time) when the message definition was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the message definition changes.

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the message definition. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource. */
    #[serde(rename = "date")]
    pub date: DateTime,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Name of the publisher (organization or individual)**

 The name of the individual or organization that published the message definition.

 Usually an organization, but may be an individual. The publisher (or steward) of the message definition is the organization or individual primarily responsible for the maintenance and upkeep of the message definition. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the message definition. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisher")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_ext: Option<FieldExtension>,
    /** **Contact details for the publisher**

 Contact details to assist a user in finding and communicating with the publisher.

 May be a web site, an email address, a telephone number, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Natural language description of the message definition**

 A free text natural language description of the message definition from a consumer's perspective.

 This description can be used to capture details such as why the message definition was built, comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the message definition as conveyed in the 'text' field of the resource itself. This item SHOULD be populated unless the information is available from context (e.g. the language of the profile is presumed to be the predominant language in the place the profile was created). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Context the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate message definition instances.

 When multiple useContexts are specified, there is no expectation whether all or any of the contexts apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useContext")]
    pub use_context: Vec<Option<UsageContext>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_useContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_context_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Intended jurisdiction for message definition (if applicable)**

 A legal or geographic region in which the message definition is intended to be used.

 It may be possible for the message definition to be used in jurisdictions other than those for which it was originally designed or intended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **Why this message definition is defined**

 Explaination of why this message definition is needed and why it has been designed as it has.

 This element does not describe the usage of the message definition Instead  it provides traceability of ''why'' the resource is either needed or ''why'' it is defined as it is.  This may be used to point to source materials or specifications that drove the structure of this message definition. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purpose")]
    pub purpose: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_purpose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub purpose_ext: Option<FieldExtension>,
    /** **Use and/or publishing restrictions**

 A copyright statement relating to the message definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the message definition.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyright")]
    pub copyright: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyright")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_ext: Option<FieldExtension>,
    /** **Definition this one is based on**

 The MessageDefinition that is the basis for the contents of this resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "base")]
    pub base: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_base")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub base_ext: Option<FieldExtension>,
    /** **Protocol/workflow this is part of**

 Identifies a protocol or workflow that this MessageDefinition represents a step in.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parent")]
    pub parent: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_parent")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub parent_ext: Vec<Option<FieldExtension>>,
    /** **Takes the place of**

 A MessageDefinition that is superseded by this definition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "replaces")]
    pub replaces: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_replaces")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub replaces_ext: Vec<Option<FieldExtension>>,
    /** **[MessageEvent](http://hl7.org/fhir/ValueSet/message-events); Event type**

 A coded identifier of a supported messaging event.

 */
    #[serde(rename = "event")]
    pub event: Coding,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_event")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub event_ext: Option<FieldExtension>,
    /** **[MessageSignificanceCategory](http://hl7.org/fhir/ValueSet/message-significance-category); Consequence | Currency | Notification**

 The impact of the content of the message.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<codes::MessageSignificanceCategory>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **Resource(s) that are the subject of the event**

 Identifies the resource (or resources) that are being addressed by the event.  For example, the Encounter for an admit message or two Account records for a merge.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "focus")]
    pub focus: Vec<Option<MessageDefinitionFocus>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_focus")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub focus_ext: Vec<Option<FieldExtension>>,
    /** **Is a response required?**

 Indicates whether a response is required for this message.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "responseRequired")]
    pub response_required: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_responseRequired")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub response_required_ext: Option<FieldExtension>,
    /** **Responses to this message**

 Indicates what types of messages may be sent as an application-level response to this message.

 This indicates an application level response to "close" a transaction implicit in a particular request message.  To define a complete workflow scenario, look to the [[PlanDefinition]] resource which allows the definition of complex orchestrations, conditionality, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "allowedResponse")]
    pub allowed_response: Vec<Option<MessageDefinitionAllowedResponse>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_allowedResponse")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub allowed_response_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl MessageDefinitionBuilder {
    #[doc = concat!("Finalize building ", "MessageDefinition", ".")]
    pub fn build(self) -> Result<MessageDefinition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<MessageDefinitionInner> for MessageDefinition {
    fn from(inner: MessageDefinitionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for MessageDefinition {
    type Target = MessageDefinitionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for MessageDefinition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl MessageDefinition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> MessageDefinitionBuilder {
        MessageDefinitionBuilder::default()
    }
}
impl MessageDefinition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::MessageDefinition
    }
}
/// Sub-fields of the focus field in MessageDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MessageDefinitionFocusBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MessageDefinitionFocus {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ResourceType](http://hl7.org/fhir/ValueSet/resource-types); Type of resource**

 The kind of resource that must be the focus for this message.

 Multiple focuses addressing different resources may occasionally occur.  E.g. to link or unlink a resource from a particular account or encounter, etc. */
    #[serde(rename = "code")]
    pub code: codes::ResourceType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Profile that must be adhered to by focus**

 A profile that reflects constraints for the focal resource (and potentially for related resources).

 This should be present for most message definitions.  However, if the message focus is only a single resource and there is no need to include referenced resources or otherwise enforce the presence of particular elements, it can be omitted. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "profile")]
    pub profile: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_profile")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub profile_ext: Option<FieldExtension>,
    /** **Minimum number of focuses of this type**

 Identifies the minimum number of resources of this type that must be pointed to by a message in order for it to be valid against this MessageDefinition.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "min")]
    pub min: Option<u32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_min")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub min_ext: Option<FieldExtension>,
    /** **Maximum number of focuses of this type**

 Identifies the maximum number of resources of this type that must be pointed to by a message in order for it to be valid against this MessageDefinition.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "max")]
    pub max: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_max")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub max_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MessageDefinitionFocus {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MessageDefinitionFocusBuilder {
        MessageDefinitionFocusBuilder::default()
    }
}
/// Sub-fields of the allowedResponse field in MessageDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MessageDefinitionAllowedResponseBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MessageDefinitionAllowedResponse {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Reference to allowed message definition response**

 A reference to the message definition that must be adhered to by this supported response.

 */
    #[serde(rename = "message")]
    pub message: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_message")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub message_ext: Option<FieldExtension>,
    /** **When should this response be used**

 Provides a description of the circumstances in which this response should be used (as opposed to one of the alternative responses).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "situation")]
    pub situation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_situation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub situation_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MessageDefinitionAllowedResponse {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MessageDefinitionAllowedResponseBuilder {
        MessageDefinitionAllowedResponseBuilder::default()
    }
}
/** Base StructureDefinition for MessageHeader Resource

 **[MessageHeader](http://hl7.org/fhir/StructureDefinition/MessageHeader) v3.0.2**

 A resource that describes a message that is exchanged between systems

 The header for a message exchange that is either requesting or responding to an action.  The reference(s) that are the subject of the action as well as other information related to the action are typically transmitted in a bundle in which the MessageHeader resource instance is the first resource in the bundle.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct MessageHeader(pub Box<MessageHeaderInner>);
/** Base StructureDefinition for MessageHeader Resource

 **[MessageHeader](http://hl7.org/fhir/StructureDefinition/MessageHeader) v3.0.2**

 A resource that describes a message that is exchanged between systems

 The header for a message exchange that is either requesting or responding to an action.  The reference(s) that are the subject of the action as well as other information related to the action are typically transmitted in a bundle in which the MessageHeader resource instance is the first resource in the bundle.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MessageHeaderBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct MessageHeaderInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "MessageHeader::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::MessageHeader", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[MessageEvent](http://hl7.org/fhir/ValueSet/message-events); Code for the event this message represents**

 Code that identifies the event this message represents and connects it with its definition. Events defined as part of the FHIR specification have the system value "http://hl7.org/fhir/message-events".

 */
    #[serde(rename = "event")]
    pub event: Coding,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_event")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub event_ext: Option<FieldExtension>,
    /** **Message destination application(s)**

 The destination application which the message is intended for.

 There SHOULD be at least one destination, but in some circumstances, the source system is unaware of any particular destination system. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "destination")]
    pub destination: Vec<Option<MessageHeaderDestination>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_destination")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub destination_ext: Vec<Option<FieldExtension>>,
    /** **Intended "real-world" recipient for the data**

 Allows data conveyed by a message to be addressed to a particular person or department when routing to a specific application isn't sufficient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "receiver")]
    pub receiver: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_receiver")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub receiver_ext: Option<FieldExtension>,
    /** **Real world sender of the message**

 Identifies the sending system to allow the use of a trust relationship.

 Use case is for where a (trusted) sending system is responsible for multiple organizations, and therefore cannot differentiate based on source endpoint / authentication alone. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sender")]
    pub sender: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sender")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sender_ext: Option<FieldExtension>,
    /** **Time that the message was sent**

 The time that the message was sent.

 */
    #[serde(rename = "timestamp")]
    pub timestamp: Instant,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_timestamp")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub timestamp_ext: Option<FieldExtension>,
    /** **The source of the data entry**

 The person or device that performed the data entry leading to this message. When there is more than one candidate, pick the most proximal to the message. Can provide other enterers in extensions.

 Usually only for the request, but can be used in a response. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "enterer")]
    pub enterer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_enterer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub enterer_ext: Option<FieldExtension>,
    /** **The source of the decision**

 The logical author of the message - the person or device that decided the described event should happen. When there is more than one candidate, pick the most proximal to the MessageHeader. Can provide other authors in extensions.

 Usually only for the request, but can be used in a response. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_author")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub author_ext: Option<FieldExtension>,
    /** **Message source application**

 The source application from which this message originated.

 */
    #[serde(rename = "source")]
    pub source: MessageHeaderSource,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_source")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_ext: Option<FieldExtension>,
    /** **Final responsibility for event**

 The person or organization that accepts overall responsibility for the contents of the message. The implication is that the message event happened under the policies of the responsible party.

 Usually only for the request, but can be used in a response. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "responsible")]
    pub responsible: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_responsible")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub responsible_ext: Option<FieldExtension>,
    /** **[EventReason](http://hl7.org/fhir/ValueSet/message-reason-encounter); Cause of event**

 Coded indication of the cause for the event - indicates  a reason for the occurrence of the event that is a focus of this message.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reason_ext: Option<FieldExtension>,
    /** **If this is a reply to prior message**

 Information about the message that this message is a response to.  Only present if this message is a response.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "response")]
    pub response: Option<MessageHeaderResponse>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_response")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub response_ext: Option<FieldExtension>,
    /** **The actual content of the message**

 The actual data of the message - a reference to the root/focus class of the event.

 The data is defined where the transaction type is defined. The transaction data is always included in the bundle that is the full message.  Only the root resource is specified.  The resources it references should be contained in the bundle but are not also listed here.  Multiple repetitions are allowed to cater for merges and other situations with multiple focal targets. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "focus")]
    pub focus: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_focus")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub focus_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl MessageHeaderBuilder {
    #[doc = concat!("Finalize building ", "MessageHeader", ".")]
    pub fn build(self) -> Result<MessageHeader, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<MessageHeaderInner> for MessageHeader {
    fn from(inner: MessageHeaderInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for MessageHeader {
    type Target = MessageHeaderInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for MessageHeader {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl MessageHeader {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> MessageHeaderBuilder {
        MessageHeaderBuilder::default()
    }
}
impl MessageHeader {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::MessageHeader
    }
}
/// Sub-fields of the destination field in MessageHeader
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MessageHeaderDestinationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MessageHeaderDestination {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Name of system**

 Human-readable name for the target system.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Particular delivery destination within the destination**

 Identifies the target end system in situations where the initial message transmission is to an intermediary system.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "target")]
    pub target: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_target")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub target_ext: Option<FieldExtension>,
    /** **Actual destination address or id**

 Indicates where the message should be routed to.

 The id may be a non-resolvable URI for systems that do not use standard network-based addresses. */
    #[serde(rename = "endpoint")]
    pub endpoint: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_endpoint")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub endpoint_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MessageHeaderDestination {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MessageHeaderDestinationBuilder {
        MessageHeaderDestinationBuilder::default()
    }
}
/// Sub-fields of the source field in MessageHeader
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MessageHeaderSourceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MessageHeaderSource {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Name of system**

 Human-readable name for the source system.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Name of software running the system**

 May include configuration or other information useful in debugging.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "software")]
    pub software: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_software")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub software_ext: Option<FieldExtension>,
    /** **Version of software running**

 Can convey versions of multiple systems in situations where a message passes through multiple hands.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Human contact for problems**

 An e-mail, phone, website or other contact point to use to resolve issues with message communications.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Option<ContactPoint>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub contact_ext: Option<FieldExtension>,
    /** **Actual message source address or id**

 Identifies the routing target to send acknowledgements to.

 The id may be a non-resolvable URI for systems that do not use standard network-based addresses. */
    #[serde(rename = "endpoint")]
    pub endpoint: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_endpoint")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub endpoint_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MessageHeaderSource {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MessageHeaderSourceBuilder {
        MessageHeaderSourceBuilder::default()
    }
}
/// Sub-fields of the response field in MessageHeader
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "MessageHeaderResponseBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct MessageHeaderResponse {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Id of original message**

 The MessageHeader.id of the message to which this message is a response.

 */
    #[serde(rename = "identifier")]
    pub identifier: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **[ResponseType](http://hl7.org/fhir/ValueSet/response-code); ok | transient-error | fatal-error**

 Code that identifies the type of response to the message - whether it was successful or not, and whether it should be resent or not.

 This is a generic response to the request message. Specific data for the response will be found in MessageHeader.focus. */
    #[serde(rename = "code")]
    pub code: codes::ResponseType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Specific list of hints/warnings/errors**

 Full details of any issues found in the message.

 This SHALL be contained in the bundle. If any of the issues are errors, the response code SHALL be an error. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "details")]
    pub details: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_details")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub details_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl MessageHeaderResponse {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> MessageHeaderResponseBuilder {
        MessageHeaderResponseBuilder::default()
    }
}
/** Base StructureDefinition for NamingSystem Resource

 **[NamingSystem](http://hl7.org/fhir/StructureDefinition/NamingSystem) v3.0.2**

 System of unique identification

 A curated namespace that issues unique symbols within that namespace for the identification of concepts, people, devices, etc.  Represents a "System" used within the Identifier and Coding data types.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct NamingSystem(pub Box<NamingSystemInner>);
/** Base StructureDefinition for NamingSystem Resource

 **[NamingSystem](http://hl7.org/fhir/StructureDefinition/NamingSystem) v3.0.2**

 System of unique identification

 A curated namespace that issues unique symbols within that namespace for the identification of concepts, people, devices, etc.  Represents a "System" used within the Identifier and Coding data types.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "NamingSystemBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct NamingSystemInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "NamingSystem::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::NamingSystem", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Name for this naming system (computer friendly)**

 A natural language name identifying the naming system. This name should be usable as an identifier for the module by machine processing applications such as code generation.

 The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure that it is computable friendly. The"symbolic name" for an OID would be captured as an extension. */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this naming system. Enables tracking the life-cycle of the content.

 Allows filtering of naming systems that are appropriate for use vs. not.
This is labeled as "Is Modifier" because applications should not use a retired naming system without due consideration. */
    #[serde(rename = "status")]
    pub status: codes::PublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[NamingSystemType](http://hl7.org/fhir/ValueSet/namingsystem-type); codesystem | identifier | root**

 Indicates the purpose for the naming system - what kinds of things does it make unique?

 */
    #[serde(rename = "kind")]
    pub kind: codes::NamingSystemType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_kind")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub kind_ext: Option<FieldExtension>,
    /** **Date this was last changed**

 The date  (and optionally time) when the naming system was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the naming system changes.

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the naming system. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource. */
    #[serde(rename = "date")]
    pub date: DateTime,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Name of the publisher (organization or individual)**

 The name of the individual or organization that published the naming system.

 Usually an organization, but may be an individual. The publisher (or steward) of the naming system is the organization or individual primarily responsible for the maintenance and upkeep of the naming system. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the naming system. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisher")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_ext: Option<FieldExtension>,
    /** **Contact details for the publisher**

 Contact details to assist a user in finding and communicating with the publisher.

 May be a web site, an email address, a telephone number, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Who maintains system namespace?**

 The name of the organization that is responsible for issuing identifiers or codes for this namespace and ensuring their non-collision.

 This is the primary organization.  Responsibility for some aspects of a namespace may be delegated. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "responsible")]
    pub responsible: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_responsible")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub responsible_ext: Option<FieldExtension>,
    /** **[IdentifierType](http://hl7.org/fhir/ValueSet/identifier-type); e.g. driver,  provider,  patient, bank etc.**

 Categorizes a naming system for easier search by grouping related naming systems.

 This will most commonly be used for identifier namespaces, but categories could potentially be useful for code systems and authorities as well. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Natural language description of the naming system**

 A free text natural language description of the naming system from a consumer's perspective. Details about what the namespace identifies including scope, granularity, version labeling, etc.

 This description can be used to capture details such as why the naming system was built, comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the naming system as conveyed in the 'text' field of the resource itself. This item SHOULD be populated unless the information is available from context (e.g. the language of the profile is presumed to be the predominant language in the place the profile was created). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Context the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate naming system instances.

 When multiple useContexts are specified, there is no expectation whether all or any of the contexts apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useContext")]
    pub use_context: Vec<Option<UsageContext>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_useContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_context_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Intended jurisdiction for naming system (if applicable)**

 A legal or geographic region in which the naming system is intended to be used.

 It may be possible for the naming system to be used in jurisdictions other than those for which it was originally designed or intended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **How/where is it used**

 Provides guidance on the use of the namespace, including the handling of formatting characters, use of upper vs. lower case, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "usage")]
    pub usage: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_usage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub usage_ext: Option<FieldExtension>,
    /** **Unique identifiers used for system**

 Indicates how the system may be identified when referenced in electronic exchange.

 Multiple identifiers may exist, either due to duplicate registration, regional rules, needs of different communication technologies, etc. */
    #[serde(rename = "uniqueId")]
    pub unique_id: Vec<Option<NamingSystemUniqueId>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_uniqueId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub unique_id_ext: Vec<Option<FieldExtension>>,
    /** **Use this instead**

 For naming systems that are retired, indicates the naming system that should be used in their place (if any).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "replacedBy")]
    pub replaced_by: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_replacedBy")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub replaced_by_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl NamingSystemBuilder {
    #[doc = concat!("Finalize building ", "NamingSystem", ".")]
    pub fn build(self) -> Result<NamingSystem, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<NamingSystemInner> for NamingSystem {
    fn from(inner: NamingSystemInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for NamingSystem {
    type Target = NamingSystemInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for NamingSystem {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl NamingSystem {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> NamingSystemBuilder {
        NamingSystemBuilder::default()
    }
}
impl NamingSystem {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::NamingSystem
    }
}
/// Sub-fields of the uniqueId field in NamingSystem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "NamingSystemUniqueIdBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct NamingSystemUniqueId {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[NamingSystemIdentifierType](http://hl7.org/fhir/ValueSet/namingsystem-identifier-type); oid | uuid | uri | other**

 Identifies the unique identifier scheme used for this particular identifier.

 Different identifier types may be used in different types of communications (OIDs for v3, URIs for FHIR, etc.).  Other includes RUIDs from v3, standard v2 code name strings, etc. */
    #[serde(rename = "type")]
    pub r#type: codes::NamingSystemIdentifierType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **The unique identifier**

 The string that should be sent over the wire to identify the code system or identifier system.

 If the value is a URI intended for use as FHIR system identifier, the URI should not contain "\" or "?" or "," since this makes escaping very difficult. */
    #[serde(rename = "value")]
    pub value: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_value")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<FieldExtension>,
    /** **Is this the id that should be used for this type**

 Indicates whether this identifier is the "preferred" identifier of this type.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "preferred")]
    pub preferred: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_preferred")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub preferred_ext: Option<FieldExtension>,
    /** **Notes about identifier usage**

 Notes about the past or intended usage of this identifier.

 e.g. "must be used in Germany" or "was initially published in error with this value". */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "comment")]
    pub comment: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_comment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub comment_ext: Option<FieldExtension>,
    /** **When is identifier valid?**

 Identifies the period of time over which this identifier is considered appropriate to refer to the naming system.  Outside of this window, the identifier might be non-deterministic.

 Within a registry, a given identifier should only be "active" for a single namespace at a time.  (Ideally, an identifier should only ever be associated with a single namespace across all time). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl NamingSystemUniqueId {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> NamingSystemUniqueIdBuilder {
        NamingSystemUniqueIdBuilder::default()
    }
}
/** Base StructureDefinition for NutritionOrder Resource

 **[NutritionOrder](http://hl7.org/fhir/StructureDefinition/NutritionOrder) v3.0.2**

 Diet, formula or nutritional supplement request

 A request to supply a diet, formula feeding (enteral) or oral nutritional supplement to a patient/resident.

 Referenced by an Order Request (workflow). */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct NutritionOrder(pub Box<NutritionOrderInner>);
/** Base StructureDefinition for NutritionOrder Resource

 **[NutritionOrder](http://hl7.org/fhir/StructureDefinition/NutritionOrder) v3.0.2**

 Diet, formula or nutritional supplement request

 A request to supply a diet, formula feeding (enteral) or oral nutritional supplement to a patient/resident.

 Referenced by an Order Request (workflow). */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "NutritionOrderBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct NutritionOrderInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "NutritionOrder::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::NutritionOrder", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Identifiers assigned to this order**

 Identifiers assigned to this order by the order sender or by the order receiver.

 The Identifier.type element can be to indicate filler vs. placer if needed.  This is explained in further detail [here](procedurerequest.html#notes). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[NutritionOrderStatus](http://hl7.org/fhir/ValueSet/nutrition-request-status); proposed | draft | planned | requested | active | on-hold | completed | cancelled | entered-in-error**

 The workflow status of the nutrition order/request.

 Typically the system placing the order sets the status to "requested". Thereafter, the order is maintained by the receiver that updates the status as the request is handled.

This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<codes::NutritionOrderStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **The person who requires the diet, formula or nutritional supplement**

 The person (patient) who needs the nutrition order for an oral diet, nutritional supplement and/or enteral or formula feeding.

 */
    #[serde(rename = "patient")]
    pub patient: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_ext: Option<FieldExtension>,
    /** **The encounter associated with this nutrition order**

 An encounter that provides additional information about the healthcare context in which this request is made.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "encounter")]
    pub encounter: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_encounter")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub encounter_ext: Option<FieldExtension>,
    /** **Date and time the nutrition order was requested**

 The date and time that this nutrition order was requested.

 */
    #[serde(rename = "dateTime")]
    pub date_time: DateTime,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_dateTime")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_time_ext: Option<FieldExtension>,
    /** **Who ordered the diet, formula or nutritional supplement**

 The practitioner that holds legal responsibility for ordering the diet, nutritional supplement, or formula feedings.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "orderer")]
    pub orderer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_orderer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub orderer_ext: Option<FieldExtension>,
    /** **List of the patient's food and nutrition-related allergies and intolerances**

 A link to a record of allergies or intolerances  which should be included in the nutrition order.

 Information on a patient's food allergies and intolerances to inform healthcare personnel about the type of foods that the patient shouldn't receive or consume. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "allergyIntolerance")]
    pub allergy_intolerance: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_allergyIntolerance")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub allergy_intolerance_ext: Vec<Option<FieldExtension>>,
    /** **[PatientDiet](http://hl7.org/fhir/ValueSet/encounter-diet); Order-specific modifier about the type of food that should be given**

 This modifier is used to convey order-specific modifiers about the type of food that should be given. These can be derived from patient allergies, intolerances, or preferences such as Halal, Vegan or Kosher. This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.

 Information on a patient's food preferences that inform healthcare personnel about the food that the patient should receive or consume. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "foodPreferenceModifier")]
    pub food_preference_modifier: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_foodPreferenceModifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub food_preference_modifier_ext: Vec<Option<FieldExtension>>,
    /** **[FoodType](http://hl7.org/fhir/ValueSet/food-type); Order-specific modifier about the type of food that should not be given**

 This modifier is used to convey order-specific modifiers about the type of food that should NOT be given. These can be derived from patient allergies, intolerances, or preferences such as No Red Meat, No Soy or No Wheat or  Gluten-Free.  While it should not be necessary to repeat allergy or intolerance information captured in the referenced AllergyIntolerance resource in the excludeFoodModifier, this element may be used to convey additional specificity related to foods that should be eliminated from the patient’s diet for any reason.  This modifier applies to the entire nutrition order inclusive of the oral diet, nutritional supplements and enteral formula feedings.

 Information on a patient's food allergies, intolerances and preferences to inform healthcare personnel about the type  of foods that the patient shouldn't receive or consume. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "excludeFoodModifier")]
    pub exclude_food_modifier: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_excludeFoodModifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub exclude_food_modifier_ext: Vec<Option<FieldExtension>>,
    /** **Oral diet components**

 Diet given orally in contrast to enteral (tube) feeding.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "oralDiet")]
    pub oral_diet: Option<NutritionOrderOralDiet>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_oralDiet")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub oral_diet_ext: Option<FieldExtension>,
    /** **Supplement components**

 Oral nutritional products given in order to add further nutritional value to the patient's diet.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "supplement")]
    pub supplement: Vec<Option<NutritionOrderSupplement>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_supplement")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub supplement_ext: Vec<Option<FieldExtension>>,
    /** **Enteral formula components**

 Feeding provided through the gastrointestinal tract via a tube, catheter, or stoma that delivers nutrition distal to the oral cavity.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "enteralFormula")]
    pub enteral_formula: Option<NutritionOrderEnteralFormula>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_enteralFormula")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub enteral_formula_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl NutritionOrderBuilder {
    #[doc = concat!("Finalize building ", "NutritionOrder", ".")]
    pub fn build(self) -> Result<NutritionOrder, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<NutritionOrderInner> for NutritionOrder {
    fn from(inner: NutritionOrderInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for NutritionOrder {
    type Target = NutritionOrderInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for NutritionOrder {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl NutritionOrder {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> NutritionOrderBuilder {
        NutritionOrderBuilder::default()
    }
}
impl NutritionOrder {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::NutritionOrder
    }
}
/// Sub-fields of the oralDiet field in NutritionOrder
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "NutritionOrderOralDietBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct NutritionOrderOralDiet {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[OralDiet](http://hl7.org/fhir/ValueSet/diet-type); Type of oral diet or diet restrictions that describe what can be consumed orally**

 The kind of diet or dietary restriction such as fiber restricted diet or diabetic diet.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub r#type_ext: Vec<Option<FieldExtension>>,
    /** **Scheduled frequency of diet**

 The time period and frequency at which the diet should be given.  The diet should be given for the combination of all schedules if more than one schedule is present.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "schedule")]
    pub schedule: Vec<Option<Timing>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_schedule")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub schedule_ext: Vec<Option<FieldExtension>>,
    /** **Required  nutrient modifications**

 Class that defines the quantity and type of nutrient modifications (for example carbohydrate, fiber or sodium) required for the oral diet.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "nutrient")]
    pub nutrient: Vec<Option<NutritionOrderOralDietNutrient>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_nutrient")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub nutrient_ext: Vec<Option<FieldExtension>>,
    /** **Required  texture modifications**

 Class that describes any texture modifications required for the patient to safely consume various types of solid foods.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "texture")]
    pub texture: Vec<Option<NutritionOrderOralDietTexture>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_texture")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub texture_ext: Vec<Option<FieldExtension>>,
    /** **[FluidConsistencyType](http://hl7.org/fhir/ValueSet/consistency-type); The required consistency of fluids and liquids provided to the patient**

 The required consistency (e.g. honey-thick, nectar-thick, thin, thickened.) of liquids or fluids served to the patient.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "fluidConsistencyType")]
    pub fluid_consistency_type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_fluidConsistencyType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub fluid_consistency_type_ext: Vec<Option<FieldExtension>>,
    /** **Instructions or additional information about the oral diet**

 Free text or additional instructions or information pertaining to the oral diet.

 Free text dosage instructions can be used for cases where the instructions are too complex to code. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instruction")]
    pub instruction: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_instruction")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub instruction_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl NutritionOrderOralDiet {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> NutritionOrderOralDietBuilder {
        NutritionOrderOralDietBuilder::default()
    }
}
/// Sub-fields of the nutrient field in NutritionOrderOralDiet
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "NutritionOrderOralDietNutrientBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct NutritionOrderOralDietNutrient {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[NutrientModifier](http://hl7.org/fhir/ValueSet/nutrient-code); Type of nutrient that is being modified**

 The nutrient that is being modified such as carbohydrate or sodium.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifier")]
    pub modifier: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_modifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub modifier_ext: Option<FieldExtension>,
    /** **Quantity of the specified nutrient**

 The quantity of the specified nutrient to include in diet.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "amount")]
    pub amount: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_amount")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub amount_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl NutritionOrderOralDietNutrient {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> NutritionOrderOralDietNutrientBuilder {
        NutritionOrderOralDietNutrientBuilder::default()
    }
}
/// Sub-fields of the texture field in NutritionOrderOralDiet
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "NutritionOrderOralDietTextureBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct NutritionOrderOralDietTexture {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[TextureModifier](http://hl7.org/fhir/ValueSet/texture-code); Code to indicate how to alter the texture of the foods, e.g. pureed**

 Any texture modifications (for solid foods) that should be made, e.g. easy to chew, chopped, ground, and pureed.

 Coupled with the foodType (Meat). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifier")]
    pub modifier: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_modifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub modifier_ext: Option<FieldExtension>,
    /** **[TextureModifiedFoodType](http://hl7.org/fhir/ValueSet/modified-foodtype); Concepts that are used to identify an entity that is ingested for nutritional purposes**

 The food type(s) (e.g. meats, all foods)  that the texture modification applies to.  This could be all foods types.

 Coupled with the textureModifier; could be (All Foods). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "foodType")]
    pub food_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_foodType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub food_type_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl NutritionOrderOralDietTexture {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> NutritionOrderOralDietTextureBuilder {
        NutritionOrderOralDietTextureBuilder::default()
    }
}
/// Sub-fields of the supplement field in NutritionOrder
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "NutritionOrderSupplementBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct NutritionOrderSupplement {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[SupplementType](http://hl7.org/fhir/ValueSet/supplement-type); Type of supplement product requested**

 The kind of nutritional supplement product required such as a high protein or pediatric clear liquid supplement.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Product or brand name of the nutritional supplement**

 The product or brand name of the nutritional supplement such as "Acme Protein Shake".

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "productName")]
    pub product_name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_productName")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_name_ext: Option<FieldExtension>,
    /** **Scheduled frequency of supplement**

 The time period and frequency at which the supplement(s) should be given.  The supplement should be given for the combination of all schedules if more than one schedule is present.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "schedule")]
    pub schedule: Vec<Option<Timing>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_schedule")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub schedule_ext: Vec<Option<FieldExtension>>,
    /** **Amount of the nutritional supplement**

 The amount of the nutritional supplement to be given.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_quantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<FieldExtension>,
    /** **Instructions or additional information about the oral supplement**

 Free text or additional instructions or information pertaining to the oral supplement.

 Free text dosage instructions can be used for cases where the instructions are too complex to code. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instruction")]
    pub instruction: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_instruction")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub instruction_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl NutritionOrderSupplement {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> NutritionOrderSupplementBuilder {
        NutritionOrderSupplementBuilder::default()
    }
}
/// Sub-fields of the enteralFormula field in NutritionOrder
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "NutritionOrderEnteralFormulaBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct NutritionOrderEnteralFormula {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[EnteralFormulaType](http://hl7.org/fhir/ValueSet/entformula-type); Type of enteral or infant formula**

 The type of enteral or infant formula such as an adult standard formula with fiber or a soy-based infant formula.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "baseFormulaType")]
    pub base_formula_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_baseFormulaType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub base_formula_type_ext: Option<FieldExtension>,
    /** **Product or brand name of the enteral or infant formula**

 The product or brand name of the enteral or infant formula product such as "ACME Adult Standard Formula".

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "baseFormulaProductName")]
    pub base_formula_product_name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_baseFormulaProductName")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub base_formula_product_name_ext: Option<FieldExtension>,
    /** **[EnteralFormulaAdditiveType](http://hl7.org/fhir/ValueSet/entformula-additive); Type of modular component to add to the feeding**

 Indicates the type of modular component such as protein, carbohydrate, fat or fiber to be provided in addition to or mixed with the base formula.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "additiveType")]
    pub additive_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_additiveType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub additive_type_ext: Option<FieldExtension>,
    /** **Product or brand name of the modular additive**

 The product or brand name of the type of modular component to be added to the formula.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "additiveProductName")]
    pub additive_product_name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_additiveProductName")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub additive_product_name_ext: Option<FieldExtension>,
    /** **Amount of energy per specified volume that is required**

 The amount of energy (calories) that the formula should provide per specified volume, typically per mL or fluid oz.  For example, an infant may require a formula that provides 24 calories per fluid ounce or an adult may require an enteral formula that provides 1.5 calorie/mL.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "caloricDensity")]
    pub caloric_density: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_caloricDensity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub caloric_density_ext: Option<FieldExtension>,
    /** **[EnteralRouteOfAdministration](http://hl7.org/fhir/ValueSet/enteral-route); How the formula should enter the patient's gastrointestinal tract**

 The route or physiological path of administration into the patient's gastrointestinal  tract for purposes of providing the formula feeding, e.g. nasogastric tube.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "routeofAdministration")]
    pub routeof_administration: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_routeofAdministration")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub routeof_administration_ext: Option<FieldExtension>,
    /** **Formula feeding instruction as structured data**

 Formula administration instructions as structured data.  This repeating structure allows for changing the administration rate or volume over time for both bolus and continuous feeding.  An example of this would be an instruction to increase the rate of continuous feeding every 2 hours.

 See implementation notes below for further discussion on how to order continuous vs bolus enteral feeding using this resource. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "administration")]
    pub administration: Vec<Option<NutritionOrderEnteralFormulaAdministration>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_administration")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub administration_ext: Vec<Option<FieldExtension>>,
    /** **Upper limit on formula volume per unit of time**

 The maximum total quantity of formula that may be administered to a subject over the period of time, e.g. 1440 mL over 24 hours.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "maxVolumeToDeliver")]
    pub max_volume_to_deliver: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_maxVolumeToDeliver")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub max_volume_to_deliver_ext: Option<FieldExtension>,
    /** **Formula feeding instructions expressed as text**

 Free text formula administration, feeding instructions or additional instructions or information.

 Free text dosage instructions can be used for cases where the instructions are too complex to code. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "administrationInstruction")]
    pub administration_instruction: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_administrationInstruction")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub administration_instruction_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl NutritionOrderEnteralFormula {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> NutritionOrderEnteralFormulaBuilder {
        NutritionOrderEnteralFormulaBuilder::default()
    }
}
/// Sub-fields of the administration field in NutritionOrderEnteralFormula
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "NutritionOrderEnteralFormulaAdministrationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct NutritionOrderEnteralFormulaAdministration {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Scheduled frequency of enteral feeding**

 The time period and frequency at which the enteral formula should be delivered to the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "schedule")]
    pub schedule: Option<Timing>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_schedule")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub schedule_ext: Option<FieldExtension>,
    /** **The volume of formula to provide**

 The volume of formula to provide to the patient per the specified administration schedule.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_quantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<FieldExtension>,
    /** **Speed with which the formula is provided per period of time**

 The rate of administration of formula via a feeding pump, e.g. 60 mL per hour, according to the specified schedule.

 Ratio is used when the quantity value in the denominator is not "1", otherwise use Quantity. For example, the Ratio datatype is used for "200 mL/4 hrs" versus the Quantity datatype for "50 mL/hr". */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub rate: Option<NutritionOrderEnteralFormulaAdministrationRate>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub rate_ext: Option<NutritionOrderEnteralFormulaAdministrationRateExtension>,
}
#[cfg(feature = "builders")]
impl NutritionOrderEnteralFormulaAdministration {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> NutritionOrderEnteralFormulaAdministrationBuilder {
        NutritionOrderEnteralFormulaAdministrationBuilder::default()
    }
}
/// Choice of types for the rate[x] field in NutritionOrderEnteralFormulaAdministration
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum NutritionOrderEnteralFormulaAdministrationRate {
    /// Variant accepting the Quantity type.
    #[serde(rename = "rateQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Ratio type.
    #[serde(rename = "rateRatio")]
    Ratio(Ratio),
}
/// Extension value for NutritionOrderEnteralFormulaAdministrationRate.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum NutritionOrderEnteralFormulaAdministrationRateExtension {
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_rateQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Ratio extension.
    #[serde(rename = "_rateRatio")]
    Ratio(FieldExtension),
}
/** Base StructureDefinition for Observation Resource

 **[Observation](http://hl7.org/fhir/StructureDefinition/Observation) v3.0.2**

 Measurements and simple assertions

 Measurements and simple assertions made about a patient, device or other subject.

 Used for simple observations such as device measurements, laboratory atomic results, vital signs, height, weight, smoking status, comments, etc.  Other resources are used to provide context for observations such as lab reports, etc. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Observation(pub Box<ObservationInner>);
/** Base StructureDefinition for Observation Resource

 **[Observation](http://hl7.org/fhir/StructureDefinition/Observation) v3.0.2**

 Measurements and simple assertions

 Measurements and simple assertions made about a patient, device or other subject.

 Used for simple observations such as device measurements, laboratory atomic results, vital signs, height, weight, smoking status, comments, etc.  Other resources are used to provide context for observations such as lab reports, etc. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ObservationBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ObservationInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Observation::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Observation", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business Identifier for observation**

 A unique identifier assigned to this observation.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Fulfills plan, proposal or order**

 A plan, proposal or order that is fulfilled in whole or in part by this event.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basedOn")]
    pub based_on: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_basedOn")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub based_on_ext: Vec<Option<FieldExtension>>,
    /** **[ObservationStatus](http://hl7.org/fhir/ValueSet/observation-status); registered | preliminary | final | amended +**

 The status of the result value.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::ObservationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[ObservationCategory](http://hl7.org/fhir/ValueSet/observation-category); Classification of  type of observation**

 A code that classifies the general type of observation being made.

 In addition to the required category valueset, this element allows various categorization schemes based on the owner’s definition of the category and effectively multiple categories can be used at once.  The level of granularity is defined by the category concepts in the value set. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub category_ext: Vec<Option<FieldExtension>>,
    /** **[ObservationCode](http://hl7.org/fhir/ValueSet/observation-codes); Type of observation (code / type)**

 Describes what was observed. Sometimes this is called the observation "name".

 */
    #[serde(rename = "code")]
    pub code: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Who and/or what this is about**

 The patient, or group of patients, location, or device whose characteristics (direct or indirect) are described by the observation and into whose record the observation is placed.  Comments: Indirect characteristics may be those of a specimen, fetus, donor,  other observer (for example a relative or EMT), or any observation made about the subject.

 One would expect this element to be a cardinality  of 1..1.  The only circumstance in which the subject can be missing is when the observation is made by a device that does not know the patient. In this case, the observation SHALL be matched to a patient through some context/channel matching technique, and at this point, the observation should be updated.

If the target of the observation is different than the subject, the general extension [observation-focal-subject](extension-observation-focal-subject.html).  may be used.  However, the distinction between the patient's own value for an observation versus that of the fetus, or the donor or blood product unit, etc., are often specified in the observation code. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Healthcare event during which this observation is made**

 The healthcare event  (e.g. a patient and healthcare provider interaction) during which this observation is made.

 This will typically be the encounter the event occurred within, but some events may be initiated prior to or after the official completion of an encounter or episode but still be tied to the context of the encounter or episode (e.g. pre-admission lab tests). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **Clinically relevant time/time-period for observation**

 The time or time-period the observed value is asserted as being true. For biological subjects - e.g. human patients - this is usually called the "physiologically relevant time". This is usually either the time of the procedure or of specimen collection, but very often the source of the date/time is not known, only the date/time itself.

 At least a date should be present unless this observation is a historical report. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub effective: Option<ObservationEffective>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub effective_ext: Option<ObservationEffectiveExtension>,
    /** **Date/Time this was made available**

 The date and time this observation was made available to providers, typically after the results have been reviewed and verified.

 Updated when the result is updated. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "issued")]
    pub issued: Option<Instant>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_issued")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub issued_ext: Option<FieldExtension>,
    /** **Who is responsible for the observation**

 Who was responsible for asserting the observed value as "true".

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_performer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub performer_ext: Vec<Option<FieldExtension>>,
    /** **Actual result**

 The information determined as a result of making the observation, if the information has a simple value.

 Normally, an observation will have either a single value or a set of related observations. A few observations (e.g. Apgar score) may have both a value and related observations (for an Apgar score, the observations from which the measure is derived). If a value is present, the datatype for this element should be determined by Observation.code. This element has a variable name depending on the type as follows: valueQuantity, valueCodeableConcept, valueString, valueBoolean, valueRange, valueRatio, valueSampledData, valueAttachment, valueTime, valueDateTime, or valuePeriod. (The name format is "'value' + the type name" with a capital on the first letter of the type).


If the data element is usually coded or if the type associated with the Observation.value defines a coded value, use CodeableConcept instead of string datatype even if the value is uncoded text.  A value set is bound to the ValueCodeableConcept element.    For further discussion and examples see the  [notes section](observation.html#notes) below. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<ObservationValue>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<ObservationValueExtension>,
    /** **[ObservationValueAbsentReason](http://hl7.org/fhir/ValueSet/observation-valueabsentreason); Why the result is missing**

 Provides a reason why the expected value in the element Observation.value[x] is missing.

 Null or exceptional values can be represented two ways in FHIR Observations.  One way is to simply include them in the value set and represent the exceptions in the value.  For example, measurement values for a serology test could be  "detected", "not detected", "inconclusive", or  "specimen unsatisfactory".   The alternate way is to use the value element for actual observations and use the explicit dataAbsentReason element to record exceptional values.  For example, the dataAbsentReason code "error" could be used when the measurement was not completed. Note that an observation may only be reported if there are values to report. For example differential cell counts values may be reported only when > 0.  Because of these options, use-case agreements are required to interpret general observations for null or exceptional values. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dataAbsentReason")]
    pub data_absent_reason: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_dataAbsentReason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub data_absent_reason_ext: Option<FieldExtension>,
    /** **[ObservationInterpretation](http://hl7.org/fhir/ValueSet/observation-interpretation); High, low, normal, etc.**

 The assessment made based on the result of the observation.  Intended as a simple compact code often placed adjacent to the result value in reports and flow sheets to signal the meaning/normalcy status of the result. Otherwise known as abnormal flag.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "interpretation")]
    pub interpretation: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_interpretation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub interpretation_ext: Option<FieldExtension>,
    /** **Comments about result**

 May include statements about significant, unexpected or unreliable values, or information about the source of the value where this may be relevant to the interpretation of the result.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "comment")]
    pub comment: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_comment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub comment_ext: Option<FieldExtension>,
    /** **[BodySite](http://hl7.org/fhir/ValueSet/body-site); Observed body part**

 Indicates the site on the subject's body where the observation was made (i.e. the target site).

 Only used if not implicit in code found in Observation.code.  In many systems, this may be represented as a related observation instead of an inline component.   If the use case requires BodySite to be handled as a separate resource (e.g. to identify and track separately) then use the standard extension[ body-site-instance](extension-body-site-instance.html). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "bodySite")]
    pub body_site: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_bodySite")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub body_site_ext: Option<FieldExtension>,
    /** **[ObservationMethod](http://hl7.org/fhir/ValueSet/observation-methods); How it was done**

 Indicates the mechanism used to perform the observation.

 Only used if not implicit in code for Observation.code. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "method")]
    pub method: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_method")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub method_ext: Option<FieldExtension>,
    /** **Specimen used for this observation**

 The specimen that was used when this observation was made.

 Should only be used if not implicit in code found in `Observation.code`.  Observations are not made on specimens themselves; they are made on a subject, but in many cases by the means of a specimen. Note that although specimens are often involved, they are not always tracked and reported explicitly. Also note that observation resources may be used in contexts that track the specimen explicitly (e.g. Diagnostic Report). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "specimen")]
    pub specimen: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_specimen")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub specimen_ext: Option<FieldExtension>,
    /** **(Measurement) Device**

 The device used to generate the observation data.

 An extension should be used if further typing of the device is needed.  Devices used to support obtaining an observation can be represented using either an extension or through the Observation.related element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "device")]
    pub device: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_device")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub device_ext: Option<FieldExtension>,
    /** **Provides guide for interpretation**

 Guidance on how to interpret the value by comparison to a normal or recommended range.

 Most observations only have one generic reference range. Systems MAY choose to restrict to only supplying the relevant reference range based on knowledge about the patient (e.g., specific to the patient's age, gender, weight and other factors), but this may not be possible or appropriate. Whenever more than one reference range is supplied, the differences between them SHOULD be provided in the reference range and/or age properties. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "referenceRange")]
    pub reference_range: Vec<Option<ObservationReferenceRange>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_referenceRange")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reference_range_ext: Vec<Option<FieldExtension>>,
    /** **Resource related to this observation**

 A  reference to another resource (usually another Observation) whose relationship is defined by the relationship type code.

 For a discussion on the ways Observations can assembled in groups together see [Notes below](observation.html#4.20.4). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "related")]
    pub related: Vec<Option<ObservationRelated>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_related")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub related_ext: Vec<Option<FieldExtension>>,
    /** **Component results**

 Some observations have multiple component observations.  These component observations are expressed as separate code value pairs that share the same attributes.  Examples include systolic and diastolic component observations for blood pressure measurement and multiple component observations for genetics observations.

 For a discussion on the ways Observations can be assembled in groups together see [Notes](observation.html#notes) below. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "component")]
    pub component: Vec<Option<ObservationComponent>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_component")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub component_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ObservationBuilder {
    #[doc = concat!("Finalize building ", "Observation", ".")]
    pub fn build(self) -> Result<Observation, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ObservationInner> for Observation {
    fn from(inner: ObservationInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Observation {
    type Target = ObservationInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Observation {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Observation {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ObservationBuilder {
        ObservationBuilder::default()
    }
}
impl Observation {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Observation
    }
}
/// Choice of types for the effective[x] field in Observation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ObservationEffective {
    /// Variant accepting the DateTime type.
    #[serde(rename = "effectiveDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "effectivePeriod")]
    Period(Period),
}
/// Extension value for ObservationEffective.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ObservationEffectiveExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_effectiveDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_effectivePeriod")]
    Period(FieldExtension),
}
/// Choice of types for the value[x] field in Observation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ObservationValue {
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "valueCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the String type.
    #[serde(rename = "valueString")]
    String(String),
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// Variant accepting the Range type.
    #[serde(rename = "valueRange")]
    Range(Range),
    /// Variant accepting the Ratio type.
    #[serde(rename = "valueRatio")]
    Ratio(Ratio),
    /// Variant accepting the SampledData type.
    #[serde(rename = "valueSampledData")]
    SampledData(SampledData),
    /// Variant accepting the Attachment type.
    #[serde(rename = "valueAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Time type.
    #[serde(rename = "valueTime")]
    Time(Time),
    /// Variant accepting the DateTime type.
    #[serde(rename = "valueDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "valuePeriod")]
    Period(Period),
}
/// Extension value for ObservationValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ObservationValueExtension {
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_valueCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_valueString")]
    String(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_valueRange")]
    Range(FieldExtension),
    /// Variant accepting the Ratio extension.
    #[serde(rename = "_valueRatio")]
    Ratio(FieldExtension),
    /// Variant accepting the SampledData extension.
    #[serde(rename = "_valueSampledData")]
    SampledData(FieldExtension),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_valueAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the Time extension.
    #[serde(rename = "_valueTime")]
    Time(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_valueDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_valuePeriod")]
    Period(FieldExtension),
}
/// Sub-fields of the referenceRange field in Observation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ObservationReferenceRangeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ObservationReferenceRange {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Low Range, if relevant**

 The value of the low bound of the reference range.  The low bound of the reference range endpoint is inclusive of the value (e.g.  reference range is >=5 - <=9).   If the low bound is omitted,  it is assumed to be meaningless (e.g. reference range is <=2.3).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "low")]
    pub low: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_low")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub low_ext: Option<FieldExtension>,
    /** **High Range, if relevant**

 The value of the high bound of the reference range.  The high bound of the reference range endpoint is inclusive of the value (e.g.  reference range is >=5 - <=9).   If the high bound is omitted,  it is assumed to be meaningless (e.g. reference range is >= 2.3).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "high")]
    pub high: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_high")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub high_ext: Option<FieldExtension>,
    /** **[ObservationRangeMeaning](http://hl7.org/fhir/ValueSet/referencerange-meaning); Reference range qualifier**

 Codes to indicate the what part of the targeted reference population it applies to. For example, the normal or therapeutic range.

 This SHOULD be populated if there is more than one range.  If this element is not present then the normal range is assumed. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[ObservationRangeType](http://hl7.org/fhir/ValueSet/referencerange-appliesto); Reference range population**

 Codes to indicate the target population this reference range applies to.  For example, a reference range may be based on the normal population or a particular sex or race.

 This SHOULD be populated if there is more than one range.  If this element is not present then the normal population is assumed. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "appliesTo")]
    pub applies_to: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_appliesTo")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub applies_to_ext: Vec<Option<FieldExtension>>,
    /** **Applicable age range, if relevant**

 The age at which this reference range is applicable. This is a neonatal age (e.g. number of weeks at term) if the meaning says so.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "age")]
    pub age: Option<Range>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_age")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub age_ext: Option<FieldExtension>,
    /** **Text based reference range in an observation**

 Text based reference range in an observation which may be used when a quantitative range is not appropriate for an observation.  An example would be a reference value of "Negative" or a list or table of 'normals'.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_text")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub text_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ObservationReferenceRange {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ObservationReferenceRangeBuilder {
        ObservationReferenceRangeBuilder::default()
    }
}
/// Sub-fields of the related field in Observation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ObservationRelatedBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ObservationRelated {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ObservationRelationshipType](http://hl7.org/fhir/ValueSet/observation-relationshiptypes); has-member | derived-from | sequel-to | replaces | qualified-by | interfered-by**

 A code specifying the kind of relationship that exists with the target resource.

 The "derived-from" type is the only logical choice when referencing the QuestionnaireAnswer resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<codes::ObservationRelationshipType>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Resource that is related to this one**

 A reference to the observation or [QuestionnaireResponse](questionnaireresponse.html#) resource that is related to this observation.

 */
    #[serde(rename = "target")]
    pub target: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_target")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub target_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ObservationRelated {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ObservationRelatedBuilder {
        ObservationRelatedBuilder::default()
    }
}
/// Sub-fields of the component field in Observation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ObservationComponentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ObservationComponent {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ObservationCode](http://hl7.org/fhir/ValueSet/observation-codes); Type of component observation (code / type)**

 Describes what was observed. Sometimes this is called the observation "code".

 */
    #[serde(rename = "code")]
    pub code: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Actual component result**

 The information determined as a result of making the observation, if the information has a simple value.

 Normally, an observation will have either a single value or a set of related observations. A few observations (e.g. Apgar score) may have both a value and related observations (for an Apgar score, the observations from which the measure is derived). If a value is present, the datatype for this element should be determined by Observation.code. A CodeableConcept with just a text would be used instead of a string if the field was usually coded, or if the type associated with the Observation.code defines a coded value.   For boolean values use valueCodeableConcept and select codes from <http://hl7.org/fhir/ValueSet/v2-0136> (these "yes/no" concepts can be mapped to the display name "true/false" or other mutually exclusive terms that may be needed").  The element, Observation.value[x], has a variable name depending on the type as follows: valueQuantity, valueCodeableConcept, valueRatio, valueChoice, valuePeriod, valueSampleData, or valueString (the name format is "'value' + the type name" with a capital on the first letter of the type). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<ObservationComponentValue>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<ObservationComponentValueExtension>,
    /** **[ObservationValueAbsentReason](http://hl7.org/fhir/ValueSet/observation-valueabsentreason); Why the component result is missing**

 Provides a reason why the expected value in the element Observation.value[x] is missing.

 "Null" or exceptional values can be represented two ways in FHIR Observations.  One way is to simply include them in the value set and represent the exceptions in the value.  For example, measurement values for a serology test could be  "detected", "not detected", "inconclusive", or  "test not done".   The alternate way is to use the value element for actual observations and use the explicit dataAbsentReason element to record exceptional values.  For example, the dataAbsentReason code "error" could be used when the measurement was not completed.  Because of these options, use-case agreements are required to interpret general observations for exceptional values. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dataAbsentReason")]
    pub data_absent_reason: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_dataAbsentReason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub data_absent_reason_ext: Option<FieldExtension>,
    /** **[ObservationInterpretation](http://hl7.org/fhir/ValueSet/observation-interpretation); High, low, normal, etc.**

 The assessment made based on the result of the observation.  Intended as a simple compact code often placed adjacent to the result value in reports and flow sheets to signal the meaning/normalcy status of the result. Otherwise known as abnormal flag.

 The component interpretation applies only to the individual component value.  For an overall interpretation all components together use thes Observation.interpretation element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "interpretation")]
    pub interpretation: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_interpretation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub interpretation_ext: Option<FieldExtension>,
    /** **Provides guide for interpretation of component result**

 Guidance on how to interpret the value by comparison to a normal or recommended range.

 Most observations only have one generic reference range. Systems MAY choose to restrict to only supplying the relevant reference range based on knowledge about the patient (e.g., specific to the patient's age, gender, weight and other factors), but this may not be possible or appropriate. Whenever more than one reference range is supplied, the differences between them SHOULD be provided in the reference range and/or age properties. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "referenceRange")]
    pub reference_range: Vec<Option<ObservationReferenceRange>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_referenceRange")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reference_range_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ObservationComponent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ObservationComponentBuilder {
        ObservationComponentBuilder::default()
    }
}
/// Choice of types for the value[x] field in ObservationComponent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ObservationComponentValue {
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "valueCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the String type.
    #[serde(rename = "valueString")]
    String(String),
    /// Variant accepting the Range type.
    #[serde(rename = "valueRange")]
    Range(Range),
    /// Variant accepting the Ratio type.
    #[serde(rename = "valueRatio")]
    Ratio(Ratio),
    /// Variant accepting the SampledData type.
    #[serde(rename = "valueSampledData")]
    SampledData(SampledData),
    /// Variant accepting the Attachment type.
    #[serde(rename = "valueAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Time type.
    #[serde(rename = "valueTime")]
    Time(Time),
    /// Variant accepting the DateTime type.
    #[serde(rename = "valueDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "valuePeriod")]
    Period(Period),
}
/// Extension value for ObservationComponentValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ObservationComponentValueExtension {
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_valueCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_valueString")]
    String(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_valueRange")]
    Range(FieldExtension),
    /// Variant accepting the Ratio extension.
    #[serde(rename = "_valueRatio")]
    Ratio(FieldExtension),
    /// Variant accepting the SampledData extension.
    #[serde(rename = "_valueSampledData")]
    SampledData(FieldExtension),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_valueAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the Time extension.
    #[serde(rename = "_valueTime")]
    Time(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_valueDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_valuePeriod")]
    Period(FieldExtension),
}
/** Base StructureDefinition for OperationDefinition Resource

 **[OperationDefinition](http://hl7.org/fhir/StructureDefinition/OperationDefinition) v3.0.2**

 Definition of an operation or a named query

 A formal computable definition of an operation (on the RESTful interface) or a named query (using the search interaction).

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct OperationDefinition(pub Box<OperationDefinitionInner>);
/** Base StructureDefinition for OperationDefinition Resource

 **[OperationDefinition](http://hl7.org/fhir/StructureDefinition/OperationDefinition) v3.0.2**

 Definition of an operation or a named query

 A formal computable definition of an operation (on the RESTful interface) or a named query (using the search interaction).

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "OperationDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct OperationDefinitionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "OperationDefinition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::OperationDefinition", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical URI to reference this operation definition (globally unique)**

 An absolute URI that is used to identify this operation definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this operation definition is (or will be) published. The URL SHOULD include the major version of the operation definition. For more information see [Technical and Business Versions](resource.html#versions).

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred.  Multiple instances may share the same url if they have a distinct version. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "url")]
    pub url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Business version of the operation definition**

 The identifier that is used to identify this version of the operation definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the operation definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.

 There may be different operation definition instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a refrence to a particular business version of the operation definition with the format [url]|[version]. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Name for this operation definition (computer friendly)**

 A natural language name identifying the operation definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.

 The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure that it is computable friendly. */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this operation definition. Enables tracking the life-cycle of the content.

 Allows filtering of operation definitions that are appropriate for use vs. not.
This is labeled as "Is Modifier" because applications should not use a retired operation definition without due consideration. */
    #[serde(rename = "status")]
    pub status: codes::PublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[OperationKind](http://hl7.org/fhir/ValueSet/operation-kind); operation | query**

 Whether this is an operation or a named query.

 Named queries are invoked differently, and have different capabilities. */
    #[serde(rename = "kind")]
    pub kind: codes::OperationKind,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_kind")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub kind_ext: Option<FieldExtension>,
    /** **For testing purposes, not real usage**

 A boolean value to indicate that this operation definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of operation definition that are appropriate for use vs. not. This is labeled as "Is Modifier" because applications should not use an experimental operation definition in production. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "experimental")]
    pub experimental: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_experimental")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub experimental_ext: Option<FieldExtension>,
    /** **Date this was last changed**

 The date  (and optionally time) when the operation definition was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the operation definition changes.

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the operation definition. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Name of the publisher (organization or individual)**

 The name of the individual or organization that published the operation definition.

 Usually an organization, but may be an individual. The publisher (or steward) of the operation definition is the organization or individual primarily responsible for the maintenance and upkeep of the operation definition. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the operation definition. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisher")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_ext: Option<FieldExtension>,
    /** **Contact details for the publisher**

 Contact details to assist a user in finding and communicating with the publisher.

 May be a web site, an email address, a telephone number, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Natural language description of the operation definition**

 A free text natural language description of the operation definition from a consumer's perspective.

 This description can be used to capture details such as why the operation definition was built, comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the operation definition as conveyed in the 'text' field of the resource itself. This item SHOULD be populated unless the information is available from context (e.g. the language of the profile is presumed to be the predominant language in the place the profile was created). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Context the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate operation definition instances.

 When multiple useContexts are specified, there is no expectation whether all or any of the contexts apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useContext")]
    pub use_context: Vec<Option<UsageContext>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_useContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_context_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Intended jurisdiction for operation definition (if applicable)**

 A legal or geographic region in which the operation definition is intended to be used.

 It may be possible for the operation definition to be used in jurisdictions other than those for which it was originally designed or intended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **Why this operation definition is defined**

 Explaination of why this operation definition is needed and why it has been designed as it has.

 This element does not describe the usage of the operation definition Instead  it provides traceability of ''why'' the resource is either needed or ''why'' it is defined as it is.  This may be used to point to source materials or specifications that drove the structure of this operation definition. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purpose")]
    pub purpose: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_purpose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub purpose_ext: Option<FieldExtension>,
    /** **Whether content is unchanged by the operation**

 Operations that are idempotent (see [HTTP specification definition of idempotent](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html)) may be invoked by performing an HTTP GET operation instead of a POST.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "idempotent")]
    pub idempotent: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_idempotent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub idempotent_ext: Option<FieldExtension>,
    /** **Name used to invoke the operation**

 The name used to invoke the operation.

 The code does not include the '$' prefix that is always included in the URL when the operation is invoked. */
    #[serde(rename = "code")]
    pub code: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Additional information about use**

 Additional information about how to use this operation or named query.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "comment")]
    pub comment: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_comment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub comment_ext: Option<FieldExtension>,
    /** **Marks this as a profile of the base**

 Indicates that this operation definition is a constraining profile on the base.

 A constrained profile can make optional parameters required or not used and clarify documentation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "base")]
    pub base: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_base")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub base_ext: Option<FieldExtension>,
    /** **[ResourceType](http://hl7.org/fhir/ValueSet/resource-types); Types this operation applies to**

 The types on which this operation can be executed.

 If the type is an abstract resource ("Resource" or "DomainResource") then the operation can be invoked on any concrete specialization. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "resource")]
    pub resource: Vec<Option<codes::ResourceType>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_resource")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub resource_ext: Vec<Option<FieldExtension>>,
    /** **Invoke at the system level?**

 Indicates whether this operation or named query can be invoked at the system level (e.g. without needing to choose a resource type for the context).

 */
    #[serde(rename = "system")]
    pub system: bool,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_system")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub system_ext: Option<FieldExtension>,
    /** **Invole at the type level?**

 Indicates whether this operation or named query can be invoked at the resource type level for any given resource type level (e.g. without needing to choose a specific resource id for the context).

 */
    #[serde(rename = "type")]
    pub r#type: bool,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Invoke on an instance?**

 Indicates whether this operation can be invoked on a particular instance of one of the given types.

 */
    #[serde(rename = "instance")]
    pub instance: bool,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_instance")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub instance_ext: Option<FieldExtension>,
    /** **Parameters for the operation/query**

 The parameters for the operation/query.

 Query Definitions only have one output parameter, named "result". This may not be described, but can be to allow a profile to be defined. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parameter")]
    pub parameter: Vec<Option<OperationDefinitionParameter>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_parameter")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub parameter_ext: Vec<Option<FieldExtension>>,
    /** **Define overloaded variants for when  generating code**

 Defines an appropriate combination of parameters to use when invoking this operation, to help code generators when generating overloaded parameter sets for this operation.

 The combinations are suggestions as to which sets of parameters to use together, but the combinations are not intended to be authoritative. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "overload")]
    pub overload: Vec<Option<OperationDefinitionOverload>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_overload")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub overload_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl OperationDefinitionBuilder {
    #[doc = concat!("Finalize building ", "OperationDefinition", ".")]
    pub fn build(self) -> Result<OperationDefinition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<OperationDefinitionInner> for OperationDefinition {
    fn from(inner: OperationDefinitionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for OperationDefinition {
    type Target = OperationDefinitionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for OperationDefinition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl OperationDefinition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> OperationDefinitionBuilder {
        OperationDefinitionBuilder::default()
    }
}
impl OperationDefinition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::OperationDefinition
    }
}
/// Sub-fields of the parameter field in OperationDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "OperationDefinitionParameterBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct OperationDefinitionParameter {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Name in Parameters.parameter.name or in URL**

 The name of used to identify the parameter.

 This name must be a token (start with a letter in a..z, and only contain letters, numerals, and underscore. Note that for search parameters (type = string, with a search type), the name may be altered by the search modifiers. */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **[OperationParameterUse](http://hl7.org/fhir/ValueSet/operation-parameter-use); in | out**

 Whether this is an input or an output parameter.

 If a parameter name is used for both an input and an output parameter, the parameter should be defined twice. */
    #[serde(rename = "use")]
    pub r#use: codes::OperationParameterUse,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_use")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#use_ext: Option<FieldExtension>,
    /** **Minimum Cardinality**

 The minimum number of times this parameter SHALL appear in the request or response.

 */
    #[serde(rename = "min")]
    pub min: i32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_min")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub min_ext: Option<FieldExtension>,
    /** **Maximum Cardinality (a number or *)**

 The maximum number of times this element is permitted to appear in the request or response.

 */
    #[serde(rename = "max")]
    pub max: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_max")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub max_ext: Option<FieldExtension>,
    /** **Description of meaning/use**

 Describes the meaning or use of this parameter.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "documentation")]
    pub documentation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_documentation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub documentation_ext: Option<FieldExtension>,
    /** **[FHIRAllTypes](http://hl7.org/fhir/ValueSet/all-types); What type this parameter has**

 The type for this parameter.

 if there is no stated parameter, then the parameter is a multi-part parameter; type and must have at least one part defined. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[SearchParamType](http://hl7.org/fhir/ValueSet/search-param-type); number | date | string | token | reference | composite | quantity | uri**

 How the parameter is understood as a search parameter. This is only used if the parameter type is 'string'.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "searchType")]
    pub search_type: Option<codes::SearchParamType>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_searchType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub search_type_ext: Option<FieldExtension>,
    /** **Profile on the type**

 A profile the specifies the rules that this parameter must conform to.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "profile")]
    pub profile: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_profile")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub profile_ext: Option<FieldExtension>,
    /** **ValueSet details if this is coded**

 Binds to a value set if this parameter is coded (code, Coding, CodeableConcept).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "binding")]
    pub binding: Option<OperationDefinitionParameterBinding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_binding")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub binding_ext: Option<FieldExtension>,
    /** **Parts of a nested Parameter**

 The parts of a nested Parameter.

 Query Definitions only have one output parameter, named "result". This may not be described, but can be to allow a profile to be defined. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "part")]
    pub part: Vec<Option<OperationDefinitionParameter>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_part")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub part_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl OperationDefinitionParameter {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> OperationDefinitionParameterBuilder {
        OperationDefinitionParameterBuilder::default()
    }
}
/// Sub-fields of the binding field in OperationDefinitionParameter
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "OperationDefinitionParameterBindingBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct OperationDefinitionParameterBinding {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[BindingStrength](http://hl7.org/fhir/ValueSet/binding-strength); required | extensible | preferred | example**

 Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.

 For further discussion, see [Using Terminologies](terminologies.html). */
    #[serde(rename = "strength")]
    pub strength: codes::BindingStrength,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_strength")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub strength_ext: Option<FieldExtension>,
    /** **Source of value set**

 Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used.

 For value sets with a referenceResource, the display can contain the value set description.  The reference may be version-specific or not. */
    #[serde(flatten)]
    pub value_set: OperationDefinitionParameterBindingValueSet,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_set_ext: Option<OperationDefinitionParameterBindingValueSetExtension>,
}
#[cfg(feature = "builders")]
impl OperationDefinitionParameterBinding {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> OperationDefinitionParameterBindingBuilder {
        OperationDefinitionParameterBindingBuilder::default()
    }
}
/// Choice of types for the valueSet[x] field in OperationDefinitionParameterBinding
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum OperationDefinitionParameterBindingValueSet {
    /// Variant accepting the Uri type.
    #[serde(rename = "valueSetUri")]
    Uri(String),
    /// Variant accepting the Reference type.
    #[serde(rename = "valueSetReference")]
    Reference(Reference),
}
/// Extension value for OperationDefinitionParameterBindingValueSet.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum OperationDefinitionParameterBindingValueSetExtension {
    /// Variant accepting the Uri extension.
    #[serde(rename = "_valueSetUri")]
    Uri(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_valueSetReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the overload field in OperationDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "OperationDefinitionOverloadBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct OperationDefinitionOverload {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Name of parameter to include in overload**

 Name of parameter to include in overload.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parameterName")]
    pub parameter_name: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_parameterName")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub parameter_name_ext: Vec<Option<FieldExtension>>,
    /** **Comments to go on overload**

 Comments to go on overload.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "comment")]
    pub comment: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_comment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub comment_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl OperationDefinitionOverload {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> OperationDefinitionOverloadBuilder {
        OperationDefinitionOverloadBuilder::default()
    }
}
/** Base StructureDefinition for OperationOutcome Resource

 **[OperationOutcome](http://hl7.org/fhir/StructureDefinition/OperationOutcome) v3.0.2**

 Information about the success/failure of an action

 A collection of error, warning or information messages that result from a system action.

 Can result from the failure of a REST call or be part of the response message returned from a request message.  If sent with extensions overriding particular issues, might even appear as part of a request message. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct OperationOutcome(pub Box<OperationOutcomeInner>);
/** Base StructureDefinition for OperationOutcome Resource

 **[OperationOutcome](http://hl7.org/fhir/StructureDefinition/OperationOutcome) v3.0.2**

 Information about the success/failure of an action

 A collection of error, warning or information messages that result from a system action.

 Can result from the failure of a REST call or be part of the response message returned from a request message.  If sent with extensions overriding particular issues, might even appear as part of a request message. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "OperationOutcomeBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct OperationOutcomeInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "OperationOutcome::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::OperationOutcome", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **A single issue associated with the action**

 An error, warning or information message that results from a system action.

 */
    #[serde(rename = "issue")]
    pub issue: Vec<Option<OperationOutcomeIssue>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_issue")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub issue_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl OperationOutcomeBuilder {
    #[doc = concat!("Finalize building ", "OperationOutcome", ".")]
    pub fn build(self) -> Result<OperationOutcome, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<OperationOutcomeInner> for OperationOutcome {
    fn from(inner: OperationOutcomeInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for OperationOutcome {
    type Target = OperationOutcomeInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for OperationOutcome {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl OperationOutcome {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> OperationOutcomeBuilder {
        OperationOutcomeBuilder::default()
    }
}
impl OperationOutcome {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::OperationOutcome
    }
}
/// Sub-fields of the issue field in OperationOutcome
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "OperationOutcomeIssueBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct OperationOutcomeIssue {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[IssueSeverity](http://hl7.org/fhir/ValueSet/issue-severity); fatal | error | warning | information**

 Indicates whether the issue indicates a variation from successful processing.

 This is labeled as "Is Modifier" because applications should not confuse hints and warnings with errors. */
    #[serde(rename = "severity")]
    pub severity: codes::IssueSeverity,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_severity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub severity_ext: Option<FieldExtension>,
    /** **[IssueType](http://hl7.org/fhir/ValueSet/issue-type); Error or warning code**

 Describes the type of the issue. The system that creates an OperationOutcome SHALL choose the most applicable code from the IssueType value set, and may additional provide its own code for the error in the details element.

 */
    #[serde(rename = "code")]
    pub code: codes::IssueType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **[IssueDetails](http://hl7.org/fhir/ValueSet/operation-outcome); Additional details about the error**

 Additional details about the error. This may be a text description of the error, or a system code that identifies the error.

 A human readable description of the error issue SHOULD be placed in details.text. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "details")]
    pub details: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_details")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub details_ext: Option<FieldExtension>,
    /** **Additional diagnostic information about the issue**

 Additional diagnostic information about the issue.  Typically, this may be a description of how a value is erroneous, or a stack dump to help trace the issue.

 Typically this field is used to provide troubleshooting information about the error. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "diagnostics")]
    pub diagnostics: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_diagnostics")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub diagnostics_ext: Option<FieldExtension>,
    /** **Path of element(s) related to issue**

 For resource issues, this will be a simple XPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised.  For HTTP errors, will be "http." + the parameter name.

 The root of the XPath is the resource or bundle that generated OperationOutcome.  Each XPath SHALL resolve to a single node.  The XPath syntax is used whether the referenced instance is expressed in XML or JSON. Note that expression is being trialed as an alternative to XPath. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "location")]
    pub location: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_location")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub location_ext: Vec<Option<FieldExtension>>,
    /** **FHIRPath of element(s) related to issue**

 A simple FHIRPath limited to element names, repetition indicators and the default child access that identifies one of the elements in the resource that caused this issue to be raised.

 The root of the FHIRPath is the resource or bundle that generated OperationOutcome.  Each FHIRPath SHALL resolve to a single node. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "expression")]
    pub expression: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_expression")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub expression_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl OperationOutcomeIssue {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> OperationOutcomeIssueBuilder {
        OperationOutcomeIssueBuilder::default()
    }
}
/** Base StructureDefinition for Organization Resource

 **[Organization](http://hl7.org/fhir/StructureDefinition/Organization) v3.0.2**

 A grouping of people or organizations with a common purpose

 A formally or informally recognized grouping of people or organizations formed for the purpose of achieving some form of collective action.  Includes companies, institutions, corporations, departments, community groups, healthcare practice groups, etc.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Organization(pub Box<OrganizationInner>);
/** Base StructureDefinition for Organization Resource

 **[Organization](http://hl7.org/fhir/StructureDefinition/Organization) v3.0.2**

 A grouping of people or organizations with a common purpose

 A formally or informally recognized grouping of people or organizations formed for the purpose of achieving some form of collective action.  Includes companies, institutions, corporations, departments, community groups, healthcare practice groups, etc.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "OrganizationBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct OrganizationInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Organization::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Organization", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Identifies this organization  across multiple systems**

 Identifier for the organization that is used to identify the organization across multiple disparate systems.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Whether the organization's record is still in active use**

 Whether the organization's record is still in active use.

 Default is true.

This active flag is not intended to be used to mark an organizations as temporarily closed or under construction. Instead the Location(s) within the Organization should have the suspended status. If further details of the reason for the suspension are required, then an extension on this element should be used.

This element is labeled as a modifier because it may be used to mark that the resource was created in error. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "active")]
    pub active: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_active")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub active_ext: Option<FieldExtension>,
    /** **[OrganizationType](http://hl7.org/fhir/ValueSet/organization-type); Kind of organization**

 The kind(s) of organization that this is.

 Organizations can be corporations, wards, sections, clinical teams, government departments, etc. Note that code is generally a classifier of the type of organization; in many applications, codes are used to identity a particular organization (say, ward) as opposed to another of the same type - these are identifiers, not codes

When considering if multiple types are appropriate, you should evaluate if child organizations would be a more appropriate use of the concept, as different types likely are in different sub-areas of the organization. This is most likely to be used where type values have orthogonal values, such as a religious, academic and medical center.

We expect that some jurisdictions will profile this optionality to be a single cardinality. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub r#type_ext: Vec<Option<FieldExtension>>,
    /** **Name used for the organization**

 A name associated with the organization.

 If the name of an organization changes, consider putting the old name in the alias column so that it can still be located through searches. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **A list of alternate names that the organization is known as, or was known as in the past**

 A list of alternate names that the organization is known as, or was known as in the past.

 There are no dates associated with the alias/historic names, as this is not intended to track when names were used, but to assist in searching so that older names can still result in identifying the organization. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "alias")]
    pub alias: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_alias")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub alias_ext: Vec<Option<FieldExtension>>,
    /** **A contact detail for the organization**

 A contact detail for the organization.

 The use code home is not to be used. Note that these contacts are not the contact details of people who are employed by or represent the organization, but official contacts for the organization itself. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "telecom")]
    pub telecom: Vec<Option<ContactPoint>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_telecom")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub telecom_ext: Vec<Option<FieldExtension>>,
    /** **An address for the organization**

 An address for the organization.

 Organization may have multiple addresses with different uses or applicable periods. The use code home is not to be used. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "address")]
    pub address: Vec<Option<Address>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_address")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub address_ext: Vec<Option<FieldExtension>>,
    /** **The organization of which this organization forms a part**

 The organization of which this organization forms a part.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "partOf")]
    pub part_of: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_partOf")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub part_of_ext: Option<FieldExtension>,
    /** **Contact for the organization for a certain purpose**

 Contact for the organization for a certain purpose.

 Where multiple contacts for the same purpose are provided there is a standard extension that can be used to determine which one is the preferred contact to use. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<OrganizationContact>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Technical endpoints providing access to services operated for the organization**

 Technical endpoints providing access to services operated for the organization.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endpoint")]
    pub endpoint: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_endpoint")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub endpoint_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl OrganizationBuilder {
    #[doc = concat!("Finalize building ", "Organization", ".")]
    pub fn build(self) -> Result<Organization, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<OrganizationInner> for Organization {
    fn from(inner: OrganizationInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Organization {
    type Target = OrganizationInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Organization {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Organization {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> OrganizationBuilder {
        OrganizationBuilder::default()
    }
}
impl Organization {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Organization
    }
}
/// Sub-fields of the contact field in Organization
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "OrganizationContactBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct OrganizationContact {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ContactPartyType](http://hl7.org/fhir/ValueSet/contactentity-type); The type of contact**

 Indicates a purpose for which the contact can be reached.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purpose")]
    pub purpose: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_purpose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub purpose_ext: Option<FieldExtension>,
    /** **A name associated with the contact**

 A name associated with the contact.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<HumanName>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Contact details (telephone, email, etc.)  for a contact**

 A contact detail (e.g. a telephone number or an email address) by which the party may be contacted.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "telecom")]
    pub telecom: Vec<Option<ContactPoint>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_telecom")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub telecom_ext: Vec<Option<FieldExtension>>,
    /** **Visiting or postal addresses for the contact**

 Visiting or postal addresses for the contact.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "address")]
    pub address: Option<Address>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_address")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub address_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl OrganizationContact {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> OrganizationContactBuilder {
        OrganizationContactBuilder::default()
    }
}
/** Base StructureDefinition for Parameters Resource

 **[Parameters](http://hl7.org/fhir/StructureDefinition/Parameters) v3.0.2**

 Operation Request or Response

 This special resource type is used to represent an operation request and response (operations.html). It has no other use, and there is no RESTful endpoint associated with it.

 The parameters that may be used are defined by the OperationDefinition resource. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Parameters(pub Box<ParametersInner>);
/** Base StructureDefinition for Parameters Resource

 **[Parameters](http://hl7.org/fhir/StructureDefinition/Parameters) v3.0.2**

 Operation Request or Response

 This special resource type is used to represent an operation request and response (operations.html). It has no other use, and there is no RESTful endpoint associated with it.

 The parameters that may be used are defined by the OperationDefinition resource. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ParametersBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ParametersInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Parameters::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Parameters", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Operation Parameter**

 A parameter passed to or received from the operation.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parameter")]
    pub parameter: Vec<Option<ParametersParameter>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_parameter")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub parameter_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ParametersBuilder {
    #[doc = concat!("Finalize building ", "Parameters", ".")]
    pub fn build(self) -> Result<Parameters, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ParametersInner> for Parameters {
    fn from(inner: ParametersInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Parameters {
    type Target = ParametersInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Parameters {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Parameters {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ParametersBuilder {
        ParametersBuilder::default()
    }
}
impl Parameters {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Parameters
    }
}
/// Sub-fields of the parameter field in Parameters
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ParametersParameterBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ParametersParameter {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Name from the definition**

 The name of the parameter (reference to the operation definition).

 */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **If parameter is a data type**

 If the parameter is a data type.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<ParametersParameterValue>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<ParametersParameterValueExtension>,
    /** **If parameter is a whole resource**

 If the parameter is a whole resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "resource")]
    pub resource: Option<Resource>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_resource")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub resource_ext: Option<FieldExtension>,
    /** **Named part of a multi-part parameter**

 A named part of a multi-part parameter.

 Only one level of nested parameters is allowed. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "part")]
    pub part: Vec<Option<ParametersParameter>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_part")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub part_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ParametersParameter {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ParametersParameterBuilder {
        ParametersParameterBuilder::default()
    }
}
/// Choice of types for the value[x] field in ParametersParameter
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ParametersParameterValue {
    /// Variant accepting the Base64Binary type.
    #[serde(rename = "valueBase64Binary")]
    Base64Binary(Base64Binary),
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// Variant accepting the Code type.
    #[serde(rename = "valueCode")]
    Code(String),
    /// Variant accepting the Date type.
    #[serde(rename = "valueDate")]
    Date(Date),
    /// Variant accepting the DateTime type.
    #[serde(rename = "valueDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Decimal type.
    #[serde(rename = "valueDecimal")]
    Decimal(f64),
    /// Variant accepting the Id type.
    #[serde(rename = "valueId")]
    Id(String),
    /// Variant accepting the Instant type.
    #[serde(rename = "valueInstant")]
    Instant(Instant),
    /// Variant accepting the Integer type.
    #[serde(rename = "valueInteger")]
    Integer(i32),
    /// Variant accepting the Markdown type.
    #[serde(rename = "valueMarkdown")]
    Markdown(String),
    /// Variant accepting the Oid type.
    #[serde(rename = "valueOid")]
    Oid(String),
    /// Variant accepting the PositiveInt type.
    #[serde(rename = "valuePositiveInt")]
    PositiveInt(NonZeroU32),
    /// Variant accepting the String type.
    #[serde(rename = "valueString")]
    String(String),
    /// Variant accepting the Time type.
    #[serde(rename = "valueTime")]
    Time(Time),
    /// Variant accepting the UnsignedInt type.
    #[serde(rename = "valueUnsignedInt")]
    UnsignedInt(u32),
    /// Variant accepting the Uri type.
    #[serde(rename = "valueUri")]
    Uri(String),
    /// Variant accepting the Address type.
    #[serde(rename = "valueAddress")]
    Address(Address),
    /// Variant accepting the Age type.
    #[serde(rename = "valueAge")]
    Age(Age),
    /// Variant accepting the Annotation type.
    #[serde(rename = "valueAnnotation")]
    Annotation(Annotation),
    /// Variant accepting the Attachment type.
    #[serde(rename = "valueAttachment")]
    Attachment(Attachment),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "valueCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Coding type.
    #[serde(rename = "valueCoding")]
    Coding(Coding),
    /// Variant accepting the ContactPoint type.
    #[serde(rename = "valueContactPoint")]
    ContactPoint(ContactPoint),
    /// Variant accepting the Count type.
    #[serde(rename = "valueCount")]
    Count(Count),
    /// Variant accepting the Distance type.
    #[serde(rename = "valueDistance")]
    Distance(Distance),
    /// Variant accepting the Duration type.
    #[serde(rename = "valueDuration")]
    Duration(Duration),
    /// Variant accepting the HumanName type.
    #[serde(rename = "valueHumanName")]
    HumanName(HumanName),
    /// Variant accepting the Identifier type.
    #[serde(rename = "valueIdentifier")]
    Identifier(Identifier),
    /// Variant accepting the Money type.
    #[serde(rename = "valueMoney")]
    Money(Money),
    /// Variant accepting the Period type.
    #[serde(rename = "valuePeriod")]
    Period(Period),
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Range type.
    #[serde(rename = "valueRange")]
    Range(Range),
    /// Variant accepting the Ratio type.
    #[serde(rename = "valueRatio")]
    Ratio(Ratio),
    /// Variant accepting the Reference type.
    #[serde(rename = "valueReference")]
    Reference(Reference),
    /// Variant accepting the SampledData type.
    #[serde(rename = "valueSampledData")]
    SampledData(SampledData),
    /// Variant accepting the Signature type.
    #[serde(rename = "valueSignature")]
    Signature(Signature),
    /// Variant accepting the Timing type.
    #[serde(rename = "valueTiming")]
    Timing(Timing),
    /// Variant accepting the Meta type.
    #[serde(rename = "valueMeta")]
    Meta(Meta),
}
/// Extension value for ParametersParameterValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ParametersParameterValueExtension {
    /// Variant accepting the Base64Binary extension.
    #[serde(rename = "_valueBase64Binary")]
    Base64Binary(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Code extension.
    #[serde(rename = "_valueCode")]
    Code(FieldExtension),
    /// Variant accepting the Date extension.
    #[serde(rename = "_valueDate")]
    Date(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_valueDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Decimal extension.
    #[serde(rename = "_valueDecimal")]
    Decimal(FieldExtension),
    /// Variant accepting the Id extension.
    #[serde(rename = "_valueId")]
    Id(FieldExtension),
    /// Variant accepting the Instant extension.
    #[serde(rename = "_valueInstant")]
    Instant(FieldExtension),
    /// Variant accepting the Integer extension.
    #[serde(rename = "_valueInteger")]
    Integer(FieldExtension),
    /// Variant accepting the Markdown extension.
    #[serde(rename = "_valueMarkdown")]
    Markdown(FieldExtension),
    /// Variant accepting the Oid extension.
    #[serde(rename = "_valueOid")]
    Oid(FieldExtension),
    /// Variant accepting the PositiveInt extension.
    #[serde(rename = "_valuePositiveInt")]
    PositiveInt(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_valueString")]
    String(FieldExtension),
    /// Variant accepting the Time extension.
    #[serde(rename = "_valueTime")]
    Time(FieldExtension),
    /// Variant accepting the UnsignedInt extension.
    #[serde(rename = "_valueUnsignedInt")]
    UnsignedInt(FieldExtension),
    /// Variant accepting the Uri extension.
    #[serde(rename = "_valueUri")]
    Uri(FieldExtension),
    /// Variant accepting the Address extension.
    #[serde(rename = "_valueAddress")]
    Address(FieldExtension),
    /// Variant accepting the Age extension.
    #[serde(rename = "_valueAge")]
    Age(FieldExtension),
    /// Variant accepting the Annotation extension.
    #[serde(rename = "_valueAnnotation")]
    Annotation(FieldExtension),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_valueAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_valueCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_valueCoding")]
    Coding(FieldExtension),
    /// Variant accepting the ContactPoint extension.
    #[serde(rename = "_valueContactPoint")]
    ContactPoint(FieldExtension),
    /// Variant accepting the Count extension.
    #[serde(rename = "_valueCount")]
    Count(FieldExtension),
    /// Variant accepting the Distance extension.
    #[serde(rename = "_valueDistance")]
    Distance(FieldExtension),
    /// Variant accepting the Duration extension.
    #[serde(rename = "_valueDuration")]
    Duration(FieldExtension),
    /// Variant accepting the HumanName extension.
    #[serde(rename = "_valueHumanName")]
    HumanName(FieldExtension),
    /// Variant accepting the Identifier extension.
    #[serde(rename = "_valueIdentifier")]
    Identifier(FieldExtension),
    /// Variant accepting the Money extension.
    #[serde(rename = "_valueMoney")]
    Money(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_valuePeriod")]
    Period(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_valueRange")]
    Range(FieldExtension),
    /// Variant accepting the Ratio extension.
    #[serde(rename = "_valueRatio")]
    Ratio(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_valueReference")]
    Reference(FieldExtension),
    /// Variant accepting the SampledData extension.
    #[serde(rename = "_valueSampledData")]
    SampledData(FieldExtension),
    /// Variant accepting the Signature extension.
    #[serde(rename = "_valueSignature")]
    Signature(FieldExtension),
    /// Variant accepting the Timing extension.
    #[serde(rename = "_valueTiming")]
    Timing(FieldExtension),
    /// Variant accepting the Meta extension.
    #[serde(rename = "_valueMeta")]
    Meta(FieldExtension),
}
/** Base StructureDefinition for Patient Resource

 **[Patient](http://hl7.org/fhir/StructureDefinition/Patient) v3.0.2**

 Information about an individual or animal receiving health care services

 Demographics and other administrative information about an individual or animal receiving care or other health-related services.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Patient(pub Box<PatientInner>);
/** Base StructureDefinition for Patient Resource

 **[Patient](http://hl7.org/fhir/StructureDefinition/Patient) v3.0.2**

 Information about an individual or animal receiving health care services

 Demographics and other administrative information about an individual or animal receiving care or other health-related services.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PatientBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct PatientInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Patient::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Patient", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **An identifier for this patient**

 An identifier for this patient.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Whether this patient's record is in active use**

 Whether this patient record is in active use.

 Default is true. If a record is inactive, and linked to an active record, then future patient/record updates should occur on the other patient

This element is labeled as a modifier because when the patient record is marked as not active it is not expected to be used/referenced without being changed back to active. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "active")]
    pub active: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_active")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub active_ext: Option<FieldExtension>,
    /** **A name associated with the patient**

 A name associated with the individual.

 A patient may have multiple names with different uses or applicable periods. For animals, the name is a "HumanName" in the sense that is assigned and used by humans and has the same patterns. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Vec<Option<HumanName>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub name_ext: Vec<Option<FieldExtension>>,
    /** **A contact detail for the individual**

 A contact detail (e.g. a telephone number or an email address) by which the individual may be contacted.

 A Patient may have multiple ways to be contacted with different uses or applicable periods.  May need to have options for contacting the person urgently and also to help with identification. The address may not go directly to the individual, but may reach another party that is able to proxy for the patient (i.e. home phone, or pet owner's phone). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "telecom")]
    pub telecom: Vec<Option<ContactPoint>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_telecom")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub telecom_ext: Vec<Option<FieldExtension>>,
    /** **[AdministrativeGender](http://hl7.org/fhir/ValueSet/administrative-gender); male | female | other | unknown**

 Administrative Gender - the gender that the patient is considered to have for administration and record keeping purposes.

 The gender may not match the biological sex as determined by genetics, or the individual's preferred identification. Note that for both humans and particularly animals, there are other legitimate possibilities than M and F, though the vast majority of systems and contexts only support M and F.  Systems providing decision support or enforcing business rules should ideally do this on the basis of Observations dealing with the specific gender aspect of interest (anatomical, chromosonal, social, etc.)  However, because these observations are infrequently recorded, defaulting to the administrative gender is common practice.  Where such defaulting occurs, rule enforcement should allow for the variation between administrative and biological, chromosonal and other gender aspects.  For example, an alert about a hysterectomy on a male should be handled as a warning or overrideable error, not a "hard" error. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "gender")]
    pub gender: Option<codes::AdministrativeGender>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_gender")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub gender_ext: Option<FieldExtension>,
    /** **The date of birth for the individual**

 The date of birth for the individual.

 At least an estimated year should be provided as a guess if the real DOB is unknown  There is a standard extension "patient-birthTime" available that should be used where Time is required (such as in maternaty/infant care systems). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "birthDate")]
    pub birth_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_birthDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub birth_date_ext: Option<FieldExtension>,
    /** **Indicates if the individual is deceased or not**

 Indicates if the individual is deceased or not.

 If there's no value in the instance it means there is no statement on whether or not the individual is deceased. Most systems will interpret the absence of a value as a sign of the person being alive.

This element is labeled as a modifier because once a patient is marked as deceased, the actions that are appropriate to perform on the patient may be significantly different. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub deceased: Option<PatientDeceased>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub deceased_ext: Option<PatientDeceasedExtension>,
    /** **Addresses for the individual**

 Addresses for the individual.

 Patient may have multiple addresses with different uses or applicable periods. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "address")]
    pub address: Vec<Option<Address>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_address")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub address_ext: Vec<Option<FieldExtension>>,
    /** **[MaritalStatus](http://hl7.org/fhir/ValueSet/marital-status); Marital (civil) status of a patient**

 This field contains a patient's most recent marital (civil) status.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "maritalStatus")]
    pub marital_status: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_maritalStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub marital_status_ext: Option<FieldExtension>,
    /** **Whether patient is part of a multiple birth**

 Indicates whether the patient is part of a multiple (bool) or indicates the actual birth order (integer).

 Where the valueInteger is provided, the number is the birth number in the sequence.
E.g. The middle birth in tripplets would be valueInteger=2 and the third born would have valueInteger=3
If a bool value was provided for this tripplets examle, then all 3 patient records would have valueBool=true (the ordering is not indicated). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub multiple_birth: Option<PatientMultipleBirth>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub multiple_birth_ext: Option<PatientMultipleBirthExtension>,
    /** **Image of the patient**

 Image of the patient.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "photo")]
    pub photo: Vec<Option<Attachment>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_photo")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub photo_ext: Vec<Option<FieldExtension>>,
    /** **A contact party (e.g. guardian, partner, friend) for the patient**

 A contact party (e.g. guardian, partner, friend) for the patient.

 Contact covers all kinds of contact parties: family members, business contacts, guardians, caregivers. Not applicable to register pedigree and family ties beyond use of having contact. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<PatientContact>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **This patient is known to be an animal (non-human)**

 This patient is known to be an animal.

 The animal element is labeled "Is Modifier" since patients may be non-human. Systems SHALL either handle patient details appropriately (e.g. inform users patient is not human) or reject declared animal records.   The absense of the animal element does not imply that the patient is a human. If a system requires such a positive assertion that the patient is human, an extension will be required.  (Do not use a species of homo-sapiens in animal species, as this would incorrectly infer that the patient is an animal). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "animal")]
    pub animal: Option<PatientAnimal>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_animal")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub animal_ext: Option<FieldExtension>,
    /** **A list of Languages which may be used to communicate with the patient about his or her health**

 Languages which may be used to communicate with the patient about his or her health.

 If no language is specified, this *implies* that the default local language is spoken.  If you need to convey proficiency for multiple modes then you need multiple Patient.Communication associations.   For animals, language is not a relevant field, and should be absent from the instance. If the Patient does not speak the default local language, then the Interpreter Required Standard can be used to explicitly declare that an interpreter is required. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "communication")]
    pub communication: Vec<Option<PatientCommunication>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_communication")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub communication_ext: Vec<Option<FieldExtension>>,
    /** **Patient's nominated primary care provider**

 Patient's nominated care provider.

 This may be the primary care provider (in a GP context), or it may be a patient nominated care manager in a community/disablity setting, or even organization that will provide people to perform the care provider roles.

It is not to be used to record Care Teams, these should be in a CareTeam resource that may be linked to the CarePlan or EpisodeOfCare resources. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "generalPractitioner")]
    pub general_practitioner: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_generalPractitioner")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub general_practitioner_ext: Vec<Option<FieldExtension>>,
    /** **Organization that is the custodian of the patient record**

 Organization that is the custodian of the patient record.

 There is only one managing organization for a specific patient record. Other organizations will have their own Patient record, and may use the Link property to join the records together (or a Person resource which can include confidence ratings for the association). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "managingOrganization")]
    pub managing_organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_managingOrganization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub managing_organization_ext: Option<FieldExtension>,
    /** **Link to another patient resource that concerns the same actual person**

 Link to another patient resource that concerns the same actual patient.

 There is no assumption that linked patient records have mutual links.

This element is labelled as a modifier because it may not be the main Patient resource, and the referenced patient should be used instead of this Patient record. This is when the link.type value is 'replaced-by'. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "link")]
    pub link: Vec<Option<PatientLink>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_link")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub link_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl PatientBuilder {
    #[doc = concat!("Finalize building ", "Patient", ".")]
    pub fn build(self) -> Result<Patient, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<PatientInner> for Patient {
    fn from(inner: PatientInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Patient {
    type Target = PatientInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Patient {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Patient {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> PatientBuilder {
        PatientBuilder::default()
    }
}
impl Patient {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Patient
    }
}
/// Choice of types for the deceased[x] field in Patient
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PatientDeceased {
    /// Variant accepting the Boolean type.
    #[serde(rename = "deceasedBoolean")]
    Boolean(bool),
    /// Variant accepting the DateTime type.
    #[serde(rename = "deceasedDateTime")]
    DateTime(DateTime),
}
/// Extension value for PatientDeceased.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PatientDeceasedExtension {
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_deceasedBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_deceasedDateTime")]
    DateTime(FieldExtension),
}
/// Choice of types for the multipleBirth[x] field in Patient
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PatientMultipleBirth {
    /// Variant accepting the Boolean type.
    #[serde(rename = "multipleBirthBoolean")]
    Boolean(bool),
    /// Variant accepting the Integer type.
    #[serde(rename = "multipleBirthInteger")]
    Integer(i32),
}
/// Extension value for PatientMultipleBirth.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PatientMultipleBirthExtension {
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_multipleBirthBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Integer extension.
    #[serde(rename = "_multipleBirthInteger")]
    Integer(FieldExtension),
}
/// Sub-fields of the contact field in Patient
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PatientContactBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PatientContact {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ContactRelationship](http://hl7.org/fhir/ValueSet/v2-0131); The kind of relationship**

 The nature of the relationship between the patient and the contact person.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relationship")]
    pub relationship: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_relationship")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub relationship_ext: Vec<Option<FieldExtension>>,
    /** **A name associated with the contact person**

 A name associated with the contact person.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<HumanName>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **A contact detail for the person**

 A contact detail for the person, e.g. a telephone number or an email address.

 Contact may have multiple ways to be contacted with different uses or applicable periods.  May need to have options for contacting the person urgently, and also to help with identification. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "telecom")]
    pub telecom: Vec<Option<ContactPoint>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_telecom")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub telecom_ext: Vec<Option<FieldExtension>>,
    /** **Address for the contact person**

 Address for the contact person.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "address")]
    pub address: Option<Address>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_address")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub address_ext: Option<FieldExtension>,
    /** **[AdministrativeGender](http://hl7.org/fhir/ValueSet/administrative-gender); male | female | other | unknown**

 Administrative Gender - the gender that the contact person is considered to have for administration and record keeping purposes.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "gender")]
    pub gender: Option<codes::AdministrativeGender>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_gender")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub gender_ext: Option<FieldExtension>,
    /** **Organization that is associated with the contact**

 Organization on behalf of which the contact is acting or for which the contact is working.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "organization")]
    pub organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_organization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub organization_ext: Option<FieldExtension>,
    /** **The period during which this contact person or organization is valid to be contacted relating to this patient**

 The period during which this contact person or organization is valid to be contacted relating to this patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl PatientContact {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PatientContactBuilder {
        PatientContactBuilder::default()
    }
}
/// Sub-fields of the animal field in Patient
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PatientAnimalBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PatientAnimal {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[AnimalSpecies](http://hl7.org/fhir/ValueSet/animal-species); E.g. Dog, Cow**

 Identifies the high level taxonomic categorization of the kind of animal.

 If the patient is non-human, at least a species SHALL be specified. Species SHALL be a widely recognised taxonomic classification.  It may or may not be Linnaean taxonomy and may or may not be at the level of species. If the level is finer than species--such as a breed code--the code system used SHALL allow inference of the species.  (The common example is that the word "Hereford" does not allow inference of the species Bos taurus, because there is a Hereford pig breed, but the SNOMED CT code for "Hereford Cattle Breed" does.). */
    #[serde(rename = "species")]
    pub species: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_species")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub species_ext: Option<FieldExtension>,
    /** **[AnimalBreed](http://hl7.org/fhir/ValueSet/animal-breeds); E.g. Poodle, Angus**

 Identifies the detailed categorization of the kind of animal.

 Breed MAY be used to provide further taxonomic or non-taxonomic classification.  It may involve local or proprietary designation--such as commercial strain--and/or additional information such as production type. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "breed")]
    pub breed: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_breed")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub breed_ext: Option<FieldExtension>,
    /** **[AnimalGenderStatus](http://hl7.org/fhir/ValueSet/animal-genderstatus); E.g. Neutered, Intact**

 Indicates the current state of the animal's reproductive organs.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "genderStatus")]
    pub gender_status: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_genderStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub gender_status_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl PatientAnimal {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PatientAnimalBuilder {
        PatientAnimalBuilder::default()
    }
}
/// Sub-fields of the communication field in Patient
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PatientCommunicationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PatientCommunication {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); The language which can be used to communicate with the patient about his or her health**

 The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. "en" for English, or "en-US" for American English versus "en-EN" for England English.

 The structure aa-BB with this exact casing is one the most widely used notations for locale. However not all systems actually code this but instead have it as free text. Hence CodeableConcept instead of code as the data type. */
    #[serde(rename = "language")]
    pub language: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_language")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub language_ext: Option<FieldExtension>,
    /** **Language preference indicator**

 Indicates whether or not the patient prefers this language (over other languages he masters up a certain level).

 This language is specifically identified for communicating healthcare information. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "preferred")]
    pub preferred: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_preferred")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub preferred_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl PatientCommunication {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PatientCommunicationBuilder {
        PatientCommunicationBuilder::default()
    }
}
/// Sub-fields of the link field in Patient
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PatientLinkBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PatientLink {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **The other patient or related person resource that the link refers to**

 The other patient resource that the link refers to.

 Referencing a RelatedPerson here removes the need to use a Person record to associate a Patient and RelatedPerson as the same individual. */
    #[serde(rename = "other")]
    pub other: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_other")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub other_ext: Option<FieldExtension>,
    /** **[LinkType](http://hl7.org/fhir/ValueSet/link-type); replaced-by | replaces | refer | seealso - type of link**

 The type of link between this patient resource and another patient resource.

 */
    #[serde(rename = "type")]
    pub r#type: codes::LinkType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl PatientLink {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PatientLinkBuilder {
        PatientLinkBuilder::default()
    }
}
/** Base StructureDefinition for PaymentNotice Resource

 **[PaymentNotice](http://hl7.org/fhir/StructureDefinition/PaymentNotice) v3.0.2**

 PaymentNotice request

 This resource provides the status of the payment for goods and services rendered, and the request and response resource references.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct PaymentNotice(pub Box<PaymentNoticeInner>);
/** Base StructureDefinition for PaymentNotice Resource

 **[PaymentNotice](http://hl7.org/fhir/StructureDefinition/PaymentNotice) v3.0.2**

 PaymentNotice request

 This resource provides the status of the payment for goods and services rendered, and the request and response resource references.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PaymentNoticeBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct PaymentNoticeInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "PaymentNotice::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::PaymentNotice", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business Identifier**

 The notice business identifier.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[PaymentNoticeStatus](http://hl7.org/fhir/ValueSet/fm-status); active | cancelled | draft | entered-in-error**

 The status of the resource instance.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **Request reference**

 Reference of resource for which payment is being made.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "request")]
    pub request: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_request")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_ext: Option<FieldExtension>,
    /** **Response reference**

 Reference of response to resource for which payment is being made.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "response")]
    pub response: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_response")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub response_ext: Option<FieldExtension>,
    /** **Payment or clearing date**

 The date when the above payment action occurrred.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "statusDate")]
    pub status_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_statusDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_date_ext: Option<FieldExtension>,
    /** **Creation date**

 The date when this resource was created.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "created")]
    pub created: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_created")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub created_ext: Option<FieldExtension>,
    /** **Insurer or Regulatory body**

 The Insurer who is target  of the request.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "target")]
    pub target: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_target")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub target_ext: Option<FieldExtension>,
    /** **Responsible practitioner**

 The practitioner who is responsible for the services rendered to the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "provider")]
    pub provider: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_provider")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub provider_ext: Option<FieldExtension>,
    /** **Responsible organization**

 The organization which is responsible for the services rendered to the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "organization")]
    pub organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_organization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub organization_ext: Option<FieldExtension>,
    /** **[PaymentStatus](http://hl7.org/fhir/ValueSet/payment-status); Whether payment has been sent or cleared**

 The payment status, typically paid: payment sent, cleared: payment received.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "paymentStatus")]
    pub payment_status: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_paymentStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub payment_status_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl PaymentNoticeBuilder {
    #[doc = concat!("Finalize building ", "PaymentNotice", ".")]
    pub fn build(self) -> Result<PaymentNotice, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<PaymentNoticeInner> for PaymentNotice {
    fn from(inner: PaymentNoticeInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for PaymentNotice {
    type Target = PaymentNoticeInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for PaymentNotice {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl PaymentNotice {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> PaymentNoticeBuilder {
        PaymentNoticeBuilder::default()
    }
}
impl PaymentNotice {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::PaymentNotice
    }
}
/** Base StructureDefinition for PaymentReconciliation Resource

 **[PaymentReconciliation](http://hl7.org/fhir/StructureDefinition/PaymentReconciliation) v3.0.2**

 PaymentReconciliation resource

 This resource provides payment details and claim references supporting a bulk payment.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct PaymentReconciliation(pub Box<PaymentReconciliationInner>);
/** Base StructureDefinition for PaymentReconciliation Resource

 **[PaymentReconciliation](http://hl7.org/fhir/StructureDefinition/PaymentReconciliation) v3.0.2**

 PaymentReconciliation resource

 This resource provides payment details and claim references supporting a bulk payment.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PaymentReconciliationBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct PaymentReconciliationInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "PaymentReconciliation::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::PaymentReconciliation", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business Identifier**

 The Response business identifier.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[PaymentReconciliationStatus](http://hl7.org/fhir/ValueSet/fm-status); active | cancelled | draft | entered-in-error**

 The status of the resource instance.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **Period covered**

 The period of time for which payments have been gathered into this bulk payment for settlement.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
    /** **Creation date**

 The date when the enclosed suite of services were performed or completed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "created")]
    pub created: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_created")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub created_ext: Option<FieldExtension>,
    /** **Insurer**

 The Insurer who produced this adjudicated response.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "organization")]
    pub organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_organization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub organization_ext: Option<FieldExtension>,
    /** **Claim reference**

 Original request resource reference.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "request")]
    pub request: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_request")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_ext: Option<FieldExtension>,
    /** **[RemittanceOutcome](http://hl7.org/fhir/ValueSet/remittance-outcome); complete | error | partial**

 Transaction status: error, complete.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "outcome")]
    pub outcome: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_outcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub outcome_ext: Option<FieldExtension>,
    /** **Disposition Message**

 A description of the status of the adjudication.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "disposition")]
    pub disposition: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_disposition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub disposition_ext: Option<FieldExtension>,
    /** **Responsible practitioner**

 The practitioner who is responsible for the services rendered to the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requestProvider")]
    pub request_provider: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requestProvider")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_provider_ext: Option<FieldExtension>,
    /** **Responsible organization**

 The organization which is responsible for the services rendered to the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requestOrganization")]
    pub request_organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requestOrganization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_organization_ext: Option<FieldExtension>,
    /** **List of settlements**

 List of individual settlement amounts and the corresponding transaction.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "detail")]
    pub detail: Vec<Option<PaymentReconciliationDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_detail")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub detail_ext: Vec<Option<FieldExtension>>,
    /** **[Forms](http://hl7.org/fhir/ValueSet/forms); Printed Form Identifier**

 The form to be used for printing the content.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "form")]
    pub form: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_form")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub form_ext: Option<FieldExtension>,
    /** **Total amount of Payment**

 Total payment amount.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "total")]
    pub total: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_total")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub total_ext: Option<FieldExtension>,
    /** **Processing comments**

 Suite of notes.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "processNote")]
    pub process_note: Vec<Option<PaymentReconciliationProcessNote>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_processNote")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub process_note_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl PaymentReconciliationBuilder {
    #[doc = concat!("Finalize building ", "PaymentReconciliation", ".")]
    pub fn build(self) -> Result<PaymentReconciliation, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<PaymentReconciliationInner> for PaymentReconciliation {
    fn from(inner: PaymentReconciliationInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for PaymentReconciliation {
    type Target = PaymentReconciliationInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for PaymentReconciliation {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl PaymentReconciliation {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> PaymentReconciliationBuilder {
        PaymentReconciliationBuilder::default()
    }
}
impl PaymentReconciliation {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::PaymentReconciliation
    }
}
/// Sub-fields of the detail field in PaymentReconciliation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PaymentReconciliationDetailBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PaymentReconciliationDetail {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[PaymentType](http://hl7.org/fhir/ValueSet/payment-type); Type code**

 Code to indicate the nature of the payment, adjustment, funds advance, etc.

 */
    #[serde(rename = "type")]
    pub r#type: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Claim**

 The claim or financial resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "request")]
    pub request: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_request")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_ext: Option<FieldExtension>,
    /** **Claim Response**

 The claim response resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "response")]
    pub response: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_response")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub response_ext: Option<FieldExtension>,
    /** **Organization which submitted the claim**

 The Organization which submitted the claim or financial transaction.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "submitter")]
    pub submitter: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_submitter")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub submitter_ext: Option<FieldExtension>,
    /** **Organization which is receiving the payment**

 The organization which is receiving the payment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "payee")]
    pub payee: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_payee")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub payee_ext: Option<FieldExtension>,
    /** **Invoice date**

 The date of the invoice or financial resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Amount being paid**

 Amount paid for this detail.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "amount")]
    pub amount: Option<Money>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_amount")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub amount_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl PaymentReconciliationDetail {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PaymentReconciliationDetailBuilder {
        PaymentReconciliationDetailBuilder::default()
    }
}
/// Sub-fields of the processNote field in PaymentReconciliation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PaymentReconciliationProcessNoteBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PaymentReconciliationProcessNote {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[NoteType](http://hl7.org/fhir/ValueSet/note-type); display | print | printoper**

 The note purpose: Print/Display.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Comment on the processing**

 The note text.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_text")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub text_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl PaymentReconciliationProcessNote {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PaymentReconciliationProcessNoteBuilder {
        PaymentReconciliationProcessNoteBuilder::default()
    }
}
/** Base StructureDefinition for Person Resource

 **[Person](http://hl7.org/fhir/StructureDefinition/Person) v3.0.2**

 A generic person record

 Demographics and administrative information about a person independent of a specific health-related context.

 The Person resource does justice to person registries that keep track of persons regardless of their role. The Person resource is also a primary resource to point to for people acting in a particular role such as SubjectofCare, Practitioner, and Agent. Very few attributes are specific to any role and so Person is kept lean. Most attributes are expected to be tied to the role the Person plays rather than the Person himself. Examples of that are Guardian (SubjectofCare), ContactParty (SubjectOfCare, Practitioner), and multipleBirthInd (SubjectofCare). */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Person(pub Box<PersonInner>);
/** Base StructureDefinition for Person Resource

 **[Person](http://hl7.org/fhir/StructureDefinition/Person) v3.0.2**

 A generic person record

 Demographics and administrative information about a person independent of a specific health-related context.

 The Person resource does justice to person registries that keep track of persons regardless of their role. The Person resource is also a primary resource to point to for people acting in a particular role such as SubjectofCare, Practitioner, and Agent. Very few attributes are specific to any role and so Person is kept lean. Most attributes are expected to be tied to the role the Person plays rather than the Person himself. Examples of that are Guardian (SubjectofCare), ContactParty (SubjectOfCare, Practitioner), and multipleBirthInd (SubjectofCare). */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PersonBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct PersonInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Person::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Person", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **A human identifier for this person**

 Identifier for a person within a particular scope.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **A name associated with the person**

 A name associated with the person.

 Person may have multiple names with different uses or applicable periods. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Vec<Option<HumanName>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub name_ext: Vec<Option<FieldExtension>>,
    /** **A contact detail for the person**

 A contact detail for the person, e.g. a telephone number or an email address.

 Person may have multiple ways to be contacted with different uses or applicable periods.  May need to have options for contacting the person urgently, and also to help with identification. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "telecom")]
    pub telecom: Vec<Option<ContactPoint>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_telecom")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub telecom_ext: Vec<Option<FieldExtension>>,
    /** **[AdministrativeGender](http://hl7.org/fhir/ValueSet/administrative-gender); male | female | other | unknown**

 Administrative Gender.

 The gender may not match the biological sex as determined by genetics, or the individual's preferred identification. Note that for both humans and particularly animals, there are other legitimate possibilities than M and F, though the vast majority of systems and contexts only support M and F. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "gender")]
    pub gender: Option<codes::AdministrativeGender>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_gender")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub gender_ext: Option<FieldExtension>,
    /** **The date on which the person was born**

 The birth date for the person.

 At least an estimated year should be provided as a guess if the real DOB is unknown. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "birthDate")]
    pub birth_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_birthDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub birth_date_ext: Option<FieldExtension>,
    /** **One or more addresses for the person**

 One or more addresses for the person.

 Person may have multiple addresses with different uses or applicable periods. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "address")]
    pub address: Vec<Option<Address>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_address")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub address_ext: Vec<Option<FieldExtension>>,
    /** **Image of the person**

 An image that can be displayed as a thumbnail of the person to enhance the identification of the individual.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "photo")]
    pub photo: Option<Attachment>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_photo")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub photo_ext: Option<FieldExtension>,
    /** **The organization that is the custodian of the person record**

 The organization that is the custodian of the person record.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "managingOrganization")]
    pub managing_organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_managingOrganization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub managing_organization_ext: Option<FieldExtension>,
    /** **This person's record is in active use**

 Whether this person's record is in active use.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "active")]
    pub active: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_active")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub active_ext: Option<FieldExtension>,
    /** **Link to a resource that concerns the same actual person**

 Link to a resource that concerns the same actual person.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "link")]
    pub link: Vec<Option<PersonLink>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_link")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub link_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl PersonBuilder {
    #[doc = concat!("Finalize building ", "Person", ".")]
    pub fn build(self) -> Result<Person, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<PersonInner> for Person {
    fn from(inner: PersonInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Person {
    type Target = PersonInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Person {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Person {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> PersonBuilder {
        PersonBuilder::default()
    }
}
impl Person {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Person
    }
}
/// Sub-fields of the link field in Person
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PersonLinkBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PersonLink {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **The resource to which this actual person is associated**

 The resource to which this actual person is associated.

 */
    #[serde(rename = "target")]
    pub target: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_target")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub target_ext: Option<FieldExtension>,
    /** **[IdentityAssuranceLevel](http://hl7.org/fhir/ValueSet/identity-assuranceLevel); level1 | level2 | level3 | level4**

 Level of assurance that this link is actually associated with the target resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "assurance")]
    pub assurance: Option<codes::IdentityAssuranceLevel>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_assurance")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub assurance_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl PersonLink {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PersonLinkBuilder {
        PersonLinkBuilder::default()
    }
}
/** Base StructureDefinition for PlanDefinition Resource

 **[PlanDefinition](http://hl7.org/fhir/StructureDefinition/PlanDefinition) v3.0.2**

 The definition of a plan for a series of actions, independent of any specific patient or context

 This resource allows for the definition of various types of plans as a sharable, consumable, and executable artifact. The resource is general enough to support the description of a broad range of clinical artifacts such as clinical decision support rules, order sets and protocols.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct PlanDefinition(pub Box<PlanDefinitionInner>);
/** Base StructureDefinition for PlanDefinition Resource

 **[PlanDefinition](http://hl7.org/fhir/StructureDefinition/PlanDefinition) v3.0.2**

 The definition of a plan for a series of actions, independent of any specific patient or context

 This resource allows for the definition of various types of plans as a sharable, consumable, and executable artifact. The resource is general enough to support the description of a broad range of clinical artifacts such as clinical decision support rules, order sets and protocols.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PlanDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct PlanDefinitionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "PlanDefinition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::PlanDefinition", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical URI to reference this plan definition (globally unique)**

 An absolute URI that is used to identify this plan definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this plan definition is (or will be) published. The URL SHOULD include the major version of the plan definition. For more information see [Technical and Business Versions](resource.html#versions).

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred.  Multiple instances may share the same url if they have a distinct version. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "url")]
    pub url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Additional identifier for the plan definition**

 A formal identifier that is used to identify this plan definition when it is represented in other formats, or referenced in a specification, model, design or an instance.

 Typically, this is used for identifiers that can go in an HL7 V3 II (instance identifier) data type, e.g., to identify this plan definition outside of FHIR, where it is not possible to use the logical URI. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Business version of the plan definition**

 The identifier that is used to identify this version of the plan definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the plan definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge assets, refer to the Decision Support Service specification. Note that a version is required for non-experimental active artifacts.

 There may be different plan definition instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a refrence to a particular business version of the plan definition with the format [url]|[version]. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Name for this plan definition (computer friendly)**

 A natural language name identifying the plan definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.

 The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure that it is computable friendly. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Name for this plan definition (human friendly)**

 A short, descriptive, user-friendly title for the plan definition.

 This name does not need to be machine-processing friendly and may contain punctuation, white-space, etc. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **[PlanDefinitionType](http://hl7.org/fhir/ValueSet/plan-definition-type); order-set | protocol | eca-rule**

 The type of asset the plan definition represents, e.g. an order set, protocol, or event-condition-action rule.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this plan definition. Enables tracking the life-cycle of the content.

 Allows filtering of plan definitions that are appropriate for use vs. not.
This is labeled as "Is Modifier" because applications should not use a retired plan definition without due consideration. */
    #[serde(rename = "status")]
    pub status: codes::PublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **For testing purposes, not real usage**

 A boolean value to indicate that this plan definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of plan definition that are appropriate for use vs. not. This is labeled as "Is Modifier" because applications should not use an experimental plan definition in production. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "experimental")]
    pub experimental: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_experimental")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub experimental_ext: Option<FieldExtension>,
    /** **Date this was last changed**

 The date  (and optionally time) when the plan definition was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the plan definition changes.

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the plan definition. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Name of the publisher (organization or individual)**

 The name of the individual or organization that published the plan definition.

 Usually an organization, but may be an individual. The publisher (or steward) of the plan definition is the organization or individual primarily responsible for the maintenance and upkeep of the plan definition. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the plan definition. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisher")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_ext: Option<FieldExtension>,
    /** **Natural language description of the plan definition**

 A free text natural language description of the plan definition from a consumer's perspective.

 This description can be used to capture details such as why the plan definition was built, comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the plan definition as conveyed in the 'text' field of the resource itself. This item SHOULD be populated unless the information is available from context (e.g. the language of the profile is presumed to be the predominant language in the place the profile was created). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Why this plan definition is defined**

 Explaination of why this plan definition is needed and why it has been designed as it has.

 This element does not describe the usage of the plan definition Instead  it provides traceability of ''why'' the resource is either needed or ''why'' it is defined as it is.  This may be used to point to source materials or specifications that drove the structure of this plan definition. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purpose")]
    pub purpose: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_purpose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub purpose_ext: Option<FieldExtension>,
    /** **Describes the clinical usage of the asset**

 A detailed description of how the asset is used from a clinical perspective.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "usage")]
    pub usage: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_usage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub usage_ext: Option<FieldExtension>,
    /** **When the plan definition was approved by publisher**

 The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.

 The 'date' element may be more recent than the approval date because of minor changes / editorial corrections. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "approvalDate")]
    pub approval_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_approvalDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub approval_date_ext: Option<FieldExtension>,
    /** **When the plan definition was last reviewed**

 The date on which the resource content was last reviewed. Review happens periodically after approval, but doesn't change the original approval date.

 If specified, this is usually after the approval date. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "lastReviewDate")]
    pub last_review_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_lastReviewDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub last_review_date_ext: Option<FieldExtension>,
    /** **When the plan definition is expected to be used**

 The period during which the plan definition content was or is planned to be in active use.

 The effective period for a plan definition  determines when the content is applicable for usage and is independent of publication and review dates. For example, a measure intended to be used for the year 2016 might be published in 2015. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "effectivePeriod")]
    pub effective_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_effectivePeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub effective_period_ext: Option<FieldExtension>,
    /** **Context the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate plan definition instances.

 When multiple useContexts are specified, there is no expectation whether all or any of the contexts apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useContext")]
    pub use_context: Vec<Option<UsageContext>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_useContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_context_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Intended jurisdiction for plan definition (if applicable)**

 A legal or geographic region in which the plan definition is intended to be used.

 It may be possible for the plan definition to be used in jurisdictions other than those for which it was originally designed or intended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **[DefinitionTopic](http://hl7.org/fhir/ValueSet/definition-topic); E.g. Education, Treatment, Assessment, etc**

 Descriptive topics related to the content of the plan definition. Topics provide a high-level categorization of the definition that can be useful for filtering and searching.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "topic")]
    pub topic: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_topic")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub topic_ext: Vec<Option<FieldExtension>>,
    /** **A content contributor**

 A contributor to the content of the asset, including authors, editors, reviewers, and endorsers.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contributor")]
    pub contributor: Vec<Option<Contributor>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contributor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contributor_ext: Vec<Option<FieldExtension>>,
    /** **Contact details for the publisher**

 Contact details to assist a user in finding and communicating with the publisher.

 May be a web site, an email address, a telephone number, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Use and/or publishing restrictions**

 A copyright statement relating to the plan definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the plan definition.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyright")]
    pub copyright: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyright")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_ext: Option<FieldExtension>,
    /** **Related artifacts for the asset**

 Related artifacts such as additional documentation, justification, or bibliographic references.

 Each related artifact is either an attachment, or a reference to another resource, but not both. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relatedArtifact")]
    pub related_artifact: Vec<Option<RelatedArtifact>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_relatedArtifact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub related_artifact_ext: Vec<Option<FieldExtension>>,
    /** **Logic used by the plan definition**

 A reference to a Library resource containing any formal logic used by the plan definition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "library")]
    pub library: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_library")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub library_ext: Vec<Option<FieldExtension>>,
    /** **What the plan is trying to accomplish**

 Goals that describe what the activities within the plan are intended to achieve. For example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "goal")]
    pub goal: Vec<Option<PlanDefinitionGoal>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_goal")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub goal_ext: Vec<Option<FieldExtension>>,
    /** **Action defined by the plan**

 An action to be taken as part of the plan.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "action")]
    pub action: Vec<Option<PlanDefinitionAction>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_action")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub action_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl PlanDefinitionBuilder {
    #[doc = concat!("Finalize building ", "PlanDefinition", ".")]
    pub fn build(self) -> Result<PlanDefinition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<PlanDefinitionInner> for PlanDefinition {
    fn from(inner: PlanDefinitionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for PlanDefinition {
    type Target = PlanDefinitionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for PlanDefinition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl PlanDefinition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> PlanDefinitionBuilder {
        PlanDefinitionBuilder::default()
    }
}
impl PlanDefinition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::PlanDefinition
    }
}
/// Sub-fields of the goal field in PlanDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PlanDefinitionGoalBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PlanDefinitionGoal {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[GoalCategory](http://hl7.org/fhir/ValueSet/goal-category); E.g. Treatment, dietary, behavioral, etc**

 Indicates a category the goal falls within.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[GoalDescription](http://hl7.org/fhir/ValueSet/clinical-findings); Code or text describing the goal**

 Human-readable and/or coded description of a specific desired objective of care, such as "control blood pressure" or "negotiate an obstacle course" or "dance with child at wedding".

 If no code is available, use CodeableConcept.text. */
    #[serde(rename = "description")]
    pub description: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **[GoalPriority](http://hl7.org/fhir/ValueSet/goal-priority); high-priority | medium-priority | low-priority**

 Identifies the expected level of importance associated with reaching/sustaining the defined goal.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "priority")]
    pub priority: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_priority")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub priority_ext: Option<FieldExtension>,
    /** **[GoalStartEvent](http://hl7.org/fhir/ValueSet/goal-start-event); When goal pursuit begins**

 The event after which the goal should begin being pursued.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "start")]
    pub start: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_start")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub start_ext: Option<FieldExtension>,
    /** **[GoalAddresses](http://hl7.org/fhir/ValueSet/condition-code); What does the goal address**

 Identifies problems, conditions, issues, or concerns the goal is intended to address.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "addresses")]
    pub addresses: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_addresses")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub addresses_ext: Vec<Option<FieldExtension>>,
    /** **Supporting documentation for the goal**

 Didactic or other informational resources associated with the goal that provide further supporting information about the goal. Information resources can include inline text commentary and links to web resources.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "documentation")]
    pub documentation: Vec<Option<RelatedArtifact>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_documentation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub documentation_ext: Vec<Option<FieldExtension>>,
    /** **Target outcome for the goal**

 Indicates what should be done and within what timeframe.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "target")]
    pub target: Vec<Option<PlanDefinitionGoalTarget>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_target")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub target_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl PlanDefinitionGoal {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PlanDefinitionGoalBuilder {
        PlanDefinitionGoalBuilder::default()
    }
}
/// Sub-fields of the target field in PlanDefinitionGoal
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PlanDefinitionGoalTargetBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PlanDefinitionGoalTarget {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[GoalTargetMeasure](http://hl7.org/fhir/ValueSet/observation-codes); The parameter whose value is to be tracked**

 The parameter whose value is to be tracked, e.g. body weigth, blood pressure, or hemoglobin A1c level.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "measure")]
    pub measure: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_measure")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub measure_ext: Option<FieldExtension>,
    /** **The target value to be achieved**

 The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%. Either the high or low or both values of the range can be specified. Whan a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub detail: Option<PlanDefinitionGoalTargetDetail>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub detail_ext: Option<PlanDefinitionGoalTargetDetailExtension>,
    /** **Reach goal within**

 Indicates the timeframe after the start of the goal in which the goal should be met.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "due")]
    pub due: Option<Duration>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_due")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub due_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl PlanDefinitionGoalTarget {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PlanDefinitionGoalTargetBuilder {
        PlanDefinitionGoalTargetBuilder::default()
    }
}
/// Choice of types for the detail[x] field in PlanDefinitionGoalTarget
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PlanDefinitionGoalTargetDetail {
    /// Variant accepting the Quantity type.
    #[serde(rename = "detailQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Range type.
    #[serde(rename = "detailRange")]
    Range(Range),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "detailCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for PlanDefinitionGoalTargetDetail.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PlanDefinitionGoalTargetDetailExtension {
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_detailQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_detailRange")]
    Range(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_detailCodeableConcept")]
    CodeableConcept(FieldExtension),
}
/// Sub-fields of the action field in PlanDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PlanDefinitionActionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PlanDefinitionAction {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **User-visible label for the action (e.g. 1. or A.)**

 A user-visible label for the action.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "label")]
    pub label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_label")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub label_ext: Option<FieldExtension>,
    /** **User-visible title**

 The title of the action displayed to a user.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **Short description of the action**

 A short description of the action used to provide a summary to display to the user.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Static text equivalent of the action, used if the dynamic aspects cannot be interpreted by the receiving system**

 A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that may not be capable of interpreting it dynamically.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "textEquivalent")]
    pub text_equivalent: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_textEquivalent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub text_equivalent_ext: Option<FieldExtension>,
    /** **Code representing the meaning of the action or sub-actions**

 A code that provides meaning for the action or action group. For example, a section may have a LOINC code for a the section of a documentation template.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub code_ext: Vec<Option<FieldExtension>>,
    /** **Why the action should be performed**

 A description of why this action is necessary or appropriate.

 This is different than the clinical evidence documentation, it's an actual business description of the reason for performing the action. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reason")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_ext: Vec<Option<FieldExtension>>,
    /** **Supporting documentation for the intended performer of the action**

 Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "documentation")]
    pub documentation: Vec<Option<RelatedArtifact>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_documentation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub documentation_ext: Vec<Option<FieldExtension>>,
    /** **What goals this action supports**

 Identifies goals that this action supports. The reference must be to a goal element defined within this plan definition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "goalId")]
    pub goal_id: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_goalId")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub goal_id_ext: Vec<Option<FieldExtension>>,
    /** **When the action should be triggered**

 A description of when the action should be triggered.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "triggerDefinition")]
    pub trigger_definition: Vec<Option<TriggerDefinition>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_triggerDefinition")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub trigger_definition_ext: Vec<Option<FieldExtension>>,
    /** **Whether or not the action is applicable**

 An expression that describes applicability criteria, or start/stop conditions for the action.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "condition")]
    pub condition: Vec<Option<PlanDefinitionActionCondition>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_condition")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub condition_ext: Vec<Option<FieldExtension>>,
    /** **Input data requirements**

 Defines input data requirements for the action.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "input")]
    pub input: Vec<Option<DataRequirement>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_input")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub input_ext: Vec<Option<FieldExtension>>,
    /** **Output data definition**

 Defines the outputs of the action, if any.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "output")]
    pub output: Vec<Option<DataRequirement>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_output")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub output_ext: Vec<Option<FieldExtension>>,
    /** **Relationship to another action**

 A relationship to another action such as "before" or "30-60 minutes after start of".

 When an action depends on multiple actions, the meaning is that all actions are dependencies, rather than that any of the actions are a dependency. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relatedAction")]
    pub related_action: Vec<Option<PlanDefinitionActionRelatedAction>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_relatedAction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub related_action_ext: Vec<Option<FieldExtension>>,
    /** **When the action should take place**

 An optional value describing when the action should be performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub timing: Option<PlanDefinitionActionTiming>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub timing_ext: Option<PlanDefinitionActionTimingExtension>,
    /** **Who should participate in the action**

 Indicates who should participate in performing the action described.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "participant")]
    pub participant: Vec<Option<PlanDefinitionActionParticipant>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_participant")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub participant_ext: Vec<Option<FieldExtension>>,
    /** **[ActionType](http://hl7.org/fhir/ValueSet/action-type); create | update | remove | fire-event**

 The type of action to perform (create, update, remove).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[ActionGroupingBehavior](http://hl7.org/fhir/ValueSet/action-grouping-behavior); visual-group | logical-group | sentence-group**

 Defines the grouping behavior for the action and its children.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "groupingBehavior")]
    pub grouping_behavior: Option<codes::ActionGroupingBehavior>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_groupingBehavior")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub grouping_behavior_ext: Option<FieldExtension>,
    /** **[ActionSelectionBehavior](http://hl7.org/fhir/ValueSet/action-selection-behavior); any | all | all-or-none | exactly-one | at-most-one | one-or-more**

 Defines the selection behavior for the action and its children.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "selectionBehavior")]
    pub selection_behavior: Option<codes::ActionSelectionBehavior>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_selectionBehavior")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub selection_behavior_ext: Option<FieldExtension>,
    /** **[ActionRequiredBehavior](http://hl7.org/fhir/ValueSet/action-required-behavior); must | could | must-unless-documented**

 Defines the requiredness behavior for the action.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requiredBehavior")]
    pub required_behavior: Option<codes::ActionRequiredBehavior>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requiredBehavior")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub required_behavior_ext: Option<FieldExtension>,
    /** **[ActionPrecheckBehavior](http://hl7.org/fhir/ValueSet/action-precheck-behavior); yes | no**

 Defines whether the action should usually be preselected.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "precheckBehavior")]
    pub precheck_behavior: Option<codes::ActionPrecheckBehavior>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_precheckBehavior")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub precheck_behavior_ext: Option<FieldExtension>,
    /** **[ActionCardinalityBehavior](http://hl7.org/fhir/ValueSet/action-cardinality-behavior); single | multiple**

 Defines whether the action can be selected multiple times.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "cardinalityBehavior")]
    pub cardinality_behavior: Option<codes::ActionCardinalityBehavior>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_cardinalityBehavior")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub cardinality_behavior_ext: Option<FieldExtension>,
    /** **Description of the activity to be performed**

 A reference to an ActivityDefinition that describes the action to be taken in detail, or a PlanDefinition that describes a series of actions to be taken.

 Note that the definition is optional, and if no definition is specified, a dynamicValue with a root (~) path can be used to define the entire resource dynamically. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definition")]
    pub definition: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_definition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub definition_ext: Option<FieldExtension>,
    /** **Transform to apply the template**

 A reference to a StructureMap resource that defines a transform that can be executed to produce the intent resource using the ActivityDefinition instance as the input.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "transform")]
    pub transform: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_transform")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub transform_ext: Option<FieldExtension>,
    /** **Dynamic aspects of the definition**

 Customizations that should be applied to the statically defined resource. For example, if the dosage of a medication must be computed based on the patient's weight, a customization would be used to specify an expression that calculated the weight, and the path on the resource that would contain the result.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dynamicValue")]
    pub dynamic_value: Vec<Option<PlanDefinitionActionDynamicValue>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_dynamicValue")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub dynamic_value_ext: Vec<Option<FieldExtension>>,
    /** **A sub-action**

 Sub actions that are contained within the action. The behavior of this action determines the functionality of the sub-actions. For example, a selection behavior of at-most-one indicates that of the sub-actions, at most one may be chosen as part of realizing the action definition.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "action")]
    pub action: Vec<Option<PlanDefinitionAction>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_action")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub action_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl PlanDefinitionAction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PlanDefinitionActionBuilder {
        PlanDefinitionActionBuilder::default()
    }
}
/// Sub-fields of the condition field in PlanDefinitionAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PlanDefinitionActionConditionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PlanDefinitionActionCondition {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ActionConditionKind](http://hl7.org/fhir/ValueSet/action-condition-kind); applicability | start | stop**

 The kind of condition.

 Applicability criteria are used to determine immediate applicability when a plan definition is applied to a given context. Start and stop criteria are carried through application and used to describe when enter/exit criteria for an action. */
    #[serde(rename = "kind")]
    pub kind: codes::ActionConditionKind,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_kind")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub kind_ext: Option<FieldExtension>,
    /** **Natural language description of the condition**

 A brief, natural language description of the condition that effectively communicates the intended semantics.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Language of the expression**

 The media type of the language for the expression.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_language")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub language_ext: Option<FieldExtension>,
    /** **Boolean-valued expression**

 An expression that returns true or false, indicating whether or not the condition is satisfied.

 The expression may be inlined, or may be a reference to a named expression within a logic library referenced by the library element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "expression")]
    pub expression: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_expression")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub expression_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl PlanDefinitionActionCondition {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PlanDefinitionActionConditionBuilder {
        PlanDefinitionActionConditionBuilder::default()
    }
}
/// Sub-fields of the relatedAction field in PlanDefinitionAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PlanDefinitionActionRelatedActionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PlanDefinitionActionRelatedAction {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **What action is this related to**

 The element id of the related action.

 */
    #[serde(rename = "actionId")]
    pub action_id: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_actionId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub action_id_ext: Option<FieldExtension>,
    /** **[ActionRelationshipType](http://hl7.org/fhir/ValueSet/action-relationship-type); before-start | before | before-end | concurrent-with-start | concurrent | concurrent-with-end | after-start | after | after-end**

 The relationship of this action to the related action.

 */
    #[serde(rename = "relationship")]
    pub relationship: codes::ActionRelationshipType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_relationship")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub relationship_ext: Option<FieldExtension>,
    /** **Time offset for the relationship**

 A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub offset: Option<PlanDefinitionActionRelatedActionOffset>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub offset_ext: Option<PlanDefinitionActionRelatedActionOffsetExtension>,
}
#[cfg(feature = "builders")]
impl PlanDefinitionActionRelatedAction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PlanDefinitionActionRelatedActionBuilder {
        PlanDefinitionActionRelatedActionBuilder::default()
    }
}
/// Choice of types for the offset[x] field in PlanDefinitionActionRelatedAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PlanDefinitionActionRelatedActionOffset {
    /// Variant accepting the Duration type.
    #[serde(rename = "offsetDuration")]
    Duration(Duration),
    /// Variant accepting the Range type.
    #[serde(rename = "offsetRange")]
    Range(Range),
}
/// Extension value for PlanDefinitionActionRelatedActionOffset.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PlanDefinitionActionRelatedActionOffsetExtension {
    /// Variant accepting the Duration extension.
    #[serde(rename = "_offsetDuration")]
    Duration(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_offsetRange")]
    Range(FieldExtension),
}
/// Choice of types for the timing[x] field in PlanDefinitionAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PlanDefinitionActionTiming {
    /// Variant accepting the DateTime type.
    #[serde(rename = "timingDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "timingPeriod")]
    Period(Period),
    /// Variant accepting the Duration type.
    #[serde(rename = "timingDuration")]
    Duration(Duration),
    /// Variant accepting the Range type.
    #[serde(rename = "timingRange")]
    Range(Range),
    /// Variant accepting the Timing type.
    #[serde(rename = "timingTiming")]
    Timing(Timing),
}
/// Extension value for PlanDefinitionActionTiming.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum PlanDefinitionActionTimingExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_timingDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_timingPeriod")]
    Period(FieldExtension),
    /// Variant accepting the Duration extension.
    #[serde(rename = "_timingDuration")]
    Duration(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_timingRange")]
    Range(FieldExtension),
    /// Variant accepting the Timing extension.
    #[serde(rename = "_timingTiming")]
    Timing(FieldExtension),
}
/// Sub-fields of the participant field in PlanDefinitionAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PlanDefinitionActionParticipantBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PlanDefinitionActionParticipant {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ActionParticipantType](http://hl7.org/fhir/ValueSet/action-participant-type); patient | practitioner | related-person**

 The type of participant in the action.

 */
    #[serde(rename = "type")]
    pub r#type: codes::ActionParticipantType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[ActionParticipantRole](http://hl7.org/fhir/ValueSet/action-participant-role); E.g. Nurse, Surgeon, Parent, etc**

 The role the participant should play in performing the described action.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "role")]
    pub role: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_role")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub role_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl PlanDefinitionActionParticipant {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PlanDefinitionActionParticipantBuilder {
        PlanDefinitionActionParticipantBuilder::default()
    }
}
/// Sub-fields of the dynamicValue field in PlanDefinitionAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PlanDefinitionActionDynamicValueBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PlanDefinitionActionDynamicValue {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Natural language description of the dynamic value**

 A brief, natural language description of the intended semantics of the dynamic value.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **The path to the element to be set dynamically**

 The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "path")]
    pub path: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_path")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub path_ext: Option<FieldExtension>,
    /** **Language of the expression**

 The media type of the language for the expression.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_language")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub language_ext: Option<FieldExtension>,
    /** **An expression that provides the dynamic value for the customization**

 An expression specifying the value of the customized element.

 The expression may be inlined, or may be a reference to a named expression within a logic library referenced by the library element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "expression")]
    pub expression: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_expression")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub expression_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl PlanDefinitionActionDynamicValue {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PlanDefinitionActionDynamicValueBuilder {
        PlanDefinitionActionDynamicValueBuilder::default()
    }
}
/** Base StructureDefinition for Practitioner Resource

 **[Practitioner](http://hl7.org/fhir/StructureDefinition/Practitioner) v3.0.2**

 A person with a  formal responsibility in the provisioning of healthcare or related services

 A person who is directly or indirectly involved in the provisioning of healthcare.

 Note that a cab driver no longer fits the bill. You probably would be interested in the organization rather than the individual? */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Practitioner(pub Box<PractitionerInner>);
/** Base StructureDefinition for Practitioner Resource

 **[Practitioner](http://hl7.org/fhir/StructureDefinition/Practitioner) v3.0.2**

 A person with a  formal responsibility in the provisioning of healthcare or related services

 A person who is directly or indirectly involved in the provisioning of healthcare.

 Note that a cab driver no longer fits the bill. You probably would be interested in the organization rather than the individual? */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PractitionerBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct PractitionerInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Practitioner::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Practitioner", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **A identifier for the person as this agent**

 An identifier that applies to this person in this role.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Whether this practitioner's record is in active use**

 Whether this practitioner's record is in active use.

 Default is true.

If the practitioner is not in use by one organization, then it should mark the period on the PractitonerRole with an end date (even if they are active) as they may be active in another role. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "active")]
    pub active: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_active")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub active_ext: Option<FieldExtension>,
    /** **The name(s) associated with the practitioner**

 The name(s) associated with the practitioner.

 The selection of the use property should ensure that there is a single usual name specified, and others use the nickname (alias), old, or other values as appropriate.

In general select the value to be used in the ResourceReference.display based on this:

1. There is more than 1 name
2. Use = usual
3. Period is current to the date of the usage
4. Use = official
5. Other order as decided by internal business rules. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Vec<Option<HumanName>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub name_ext: Vec<Option<FieldExtension>>,
    /** **A contact detail for the practitioner (that apply to all roles)**

 A contact detail for the practitioner, e.g. a telephone number or an email address.

 Person may have multiple ways to be contacted with different uses or applicable periods.  May need to have options for contacting the person urgently, and also to help with identification

These typically will have home numbers, or mobile numbers that are not role specific. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "telecom")]
    pub telecom: Vec<Option<ContactPoint>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_telecom")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub telecom_ext: Vec<Option<FieldExtension>>,
    /** **Address(es) of the practitioner that are not role specific (typically home address)**

 Address(es) of the practitioner that are not role specific (typically home address).
Work addresses are not typically entered in this property as they are usually role dependent.

 The PractitionerRole does not have an address value on it, as it is expected that the location property be used for this purpose (which has an address). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "address")]
    pub address: Vec<Option<Address>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_address")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub address_ext: Vec<Option<FieldExtension>>,
    /** **[AdministrativeGender](http://hl7.org/fhir/ValueSet/administrative-gender); male | female | other | unknown**

 Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "gender")]
    pub gender: Option<codes::AdministrativeGender>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_gender")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub gender_ext: Option<FieldExtension>,
    /** **The date  on which the practitioner was born**

 The date of birth for the practitioner.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "birthDate")]
    pub birth_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_birthDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub birth_date_ext: Option<FieldExtension>,
    /** **Image of the person**

 Image of the person.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "photo")]
    pub photo: Vec<Option<Attachment>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_photo")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub photo_ext: Vec<Option<FieldExtension>>,
    /** **Qualifications obtained by training and certification**

 Qualifications obtained by training and certification.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "qualification")]
    pub qualification: Vec<Option<PractitionerQualification>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_qualification")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub qualification_ext: Vec<Option<FieldExtension>>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); A language the practitioner is able to use in patient communication**

 A language the practitioner is able to use in patient communication.

 The structure aa-BB with this exact casing is one the most widely used notations for locale. However not all systems actually code this but instead have it as free text. Hence CodeableConcept instead of code as the data type. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "communication")]
    pub communication: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_communication")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub communication_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl PractitionerBuilder {
    #[doc = concat!("Finalize building ", "Practitioner", ".")]
    pub fn build(self) -> Result<Practitioner, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<PractitionerInner> for Practitioner {
    fn from(inner: PractitionerInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Practitioner {
    type Target = PractitionerInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Practitioner {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Practitioner {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> PractitionerBuilder {
        PractitionerBuilder::default()
    }
}
impl Practitioner {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Practitioner
    }
}
/// Sub-fields of the qualification field in Practitioner
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PractitionerQualificationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PractitionerQualification {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **An identifier for this qualification for the practitioner**

 An identifier that applies to this person's qualification in this role.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[Qualification](http://hl7.org/fhir/ValueSet/v2-2.7-0360); Coded representation of the qualification**

 Coded representation of the qualification.

 */
    #[serde(rename = "code")]
    pub code: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Period during which the qualification is valid**

 Period during which the qualification is valid.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
    /** **Organization that regulates and issues the qualification**

 Organization that regulates and issues the qualification.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "issuer")]
    pub issuer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_issuer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub issuer_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl PractitionerQualification {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PractitionerQualificationBuilder {
        PractitionerQualificationBuilder::default()
    }
}
/** Base StructureDefinition for PractitionerRole Resource

 **[PractitionerRole](http://hl7.org/fhir/StructureDefinition/PractitionerRole) v3.0.2**

 Roles/organizations the practitioner is associated with

 A specific set of Roles/Locations/specialties/services that a practitioner may perform at an organization for a period of time.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct PractitionerRole(pub Box<PractitionerRoleInner>);
/** Base StructureDefinition for PractitionerRole Resource

 **[PractitionerRole](http://hl7.org/fhir/StructureDefinition/PractitionerRole) v3.0.2**

 Roles/organizations the practitioner is associated with

 A specific set of Roles/Locations/specialties/services that a practitioner may perform at an organization for a period of time.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PractitionerRoleBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct PractitionerRoleInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "PractitionerRole::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::PractitionerRole", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business Identifiers that are specific to a role/location**

 Business Identifiers that are specific to a role/location.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Whether this practitioner's record is in active use**

 Whether this practitioner's record is in active use.

 Default is true.

If the practitioner is not in use by one organization, then it should mark the period on the PractitonerRole with an end date (even if they are active) as they may be active in another role. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "active")]
    pub active: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_active")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub active_ext: Option<FieldExtension>,
    /** **The period during which the practitioner is authorized to perform in these role(s)**

 The period during which the person is authorized to act as a practitioner in these role(s) for the organization.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
    /** **Practitioner that is able to provide the defined services for the organation**

 Practitioner that is able to provide the defined services for the organation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "practitioner")]
    pub practitioner: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_practitioner")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub practitioner_ext: Option<FieldExtension>,
    /** **Organization where the roles are available**

 The organization where the Practitioner performs the roles associated.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "organization")]
    pub organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_organization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub organization_ext: Option<FieldExtension>,
    /** **[PractitionerRole](http://hl7.org/fhir/ValueSet/practitioner-role); Roles which this practitioner may perform**

 Roles which this practitioner is authorized to perform for the organization.

 A person may have more than one role. At least one role is required. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub code_ext: Vec<Option<FieldExtension>>,
    /** **[PractitionerSpecialty](http://hl7.org/fhir/ValueSet/c80-practice-codes); Specific specialty of the practitioner**

 Specific specialty of the practitioner.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "specialty")]
    pub specialty: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_specialty")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub specialty_ext: Vec<Option<FieldExtension>>,
    /** **The location(s) at which this practitioner provides care**

 The location(s) at which this practitioner provides care.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "location")]
    pub location: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_location")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub location_ext: Vec<Option<FieldExtension>>,
    /** **The list of healthcare services that this worker provides for this role's Organization/Location(s)**

 The list of healthcare services that this worker provides for this role's Organization/Location(s).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "healthcareService")]
    pub healthcare_service: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_healthcareService")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub healthcare_service_ext: Vec<Option<FieldExtension>>,
    /** **Contact details that are specific to the role/location/service**

 Contact details that are specific to the role/location/service.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "telecom")]
    pub telecom: Vec<Option<ContactPoint>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_telecom")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub telecom_ext: Vec<Option<FieldExtension>>,
    /** **Times the Service Site is available**

 A collection of times that the Service Site is available.

 More detailed availability information may be provided in associated Schedule/Slot resources. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "availableTime")]
    pub available_time: Vec<Option<PractitionerRoleAvailableTime>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_availableTime")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub available_time_ext: Vec<Option<FieldExtension>>,
    /** **Not available during this time due to provided reason**

 The HealthcareService is not available during this period of time due to the provided reason.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "notAvailable")]
    pub not_available: Vec<Option<PractitionerRoleNotAvailable>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_notAvailable")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub not_available_ext: Vec<Option<FieldExtension>>,
    /** **Description of availability exceptions**

 A description of site availability exceptions, e.g. public holiday availability. Succinctly describing all possible exceptions to normal site availability as details in the available Times and not available Times.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "availabilityExceptions")]
    pub availability_exceptions: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_availabilityExceptions")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub availability_exceptions_ext: Option<FieldExtension>,
    /** **Technical endpoints providing access to services operated for the practitioner with this role**

 Technical endpoints providing access to services operated for the practitioner with this role.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endpoint")]
    pub endpoint: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_endpoint")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub endpoint_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl PractitionerRoleBuilder {
    #[doc = concat!("Finalize building ", "PractitionerRole", ".")]
    pub fn build(self) -> Result<PractitionerRole, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<PractitionerRoleInner> for PractitionerRole {
    fn from(inner: PractitionerRoleInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for PractitionerRole {
    type Target = PractitionerRoleInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for PractitionerRole {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl PractitionerRole {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> PractitionerRoleBuilder {
        PractitionerRoleBuilder::default()
    }
}
impl PractitionerRole {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::PractitionerRole
    }
}
/// Sub-fields of the availableTime field in PractitionerRole
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PractitionerRoleAvailableTimeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PractitionerRoleAvailableTime {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DaysOfWeek](http://hl7.org/fhir/ValueSet/days-of-week); mon | tue | wed | thu | fri | sat | sun**

 Indicates which days of the week are available between the start and end Times.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "daysOfWeek")]
    pub days_of_week: Vec<Option<codes::DaysOfWeek>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_daysOfWeek")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub days_of_week_ext: Vec<Option<FieldExtension>>,
    /** **Always available? e.g. 24 hour service**

 Is this always available? (hence times are irrelevant) e.g. 24 hour service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "allDay")]
    pub all_day: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_allDay")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub all_day_ext: Option<FieldExtension>,
    /** **Opening time of day (ignored if allDay = true)**

 The opening time of day. Note: If the AllDay flag is set, then this time is ignored.

 The timezone is expected to be for where this HealthcareService is provided at. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "availableStartTime")]
    pub available_start_time: Option<Time>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_availableStartTime")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub available_start_time_ext: Option<FieldExtension>,
    /** **Closing time of day (ignored if allDay = true)**

 The closing time of day. Note: If the AllDay flag is set, then this time is ignored.

 The timezone is expected to be for where this HealthcareService is provided at. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "availableEndTime")]
    pub available_end_time: Option<Time>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_availableEndTime")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub available_end_time_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl PractitionerRoleAvailableTime {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PractitionerRoleAvailableTimeBuilder {
        PractitionerRoleAvailableTimeBuilder::default()
    }
}
/// Sub-fields of the notAvailable field in PractitionerRole
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "PractitionerRoleNotAvailableBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct PractitionerRoleNotAvailable {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Reason presented to the user explaining why time not available**

 The reason that can be presented to the user as to why this time is not available.

 */
    #[serde(rename = "description")]
    pub description: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Service not availablefrom this date**

 Service is not available (seasonally or for a public holiday) from this date.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "during")]
    pub during: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_during")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub during_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl PractitionerRoleNotAvailable {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> PractitionerRoleNotAvailableBuilder {
        PractitionerRoleNotAvailableBuilder::default()
    }
}
/** Base StructureDefinition for Procedure Resource

 **[Procedure](http://hl7.org/fhir/StructureDefinition/Procedure) v3.0.2**

 An action that is being or was performed on a patient

 An action that is or was performed on a patient. This can be a physical intervention like an operation, or less invasive like counseling or hypnotherapy.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Procedure(pub Box<ProcedureInner>);
/** Base StructureDefinition for Procedure Resource

 **[Procedure](http://hl7.org/fhir/StructureDefinition/Procedure) v3.0.2**

 An action that is being or was performed on a patient

 An action that is or was performed on a patient. This can be a physical intervention like an operation, or less invasive like counseling or hypnotherapy.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ProcedureBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ProcedureInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Procedure::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Procedure", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **External Identifiers for this procedure**

 This records identifiers associated with this procedure that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate (e.g. in CDA documents, or in written / printed documentation).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Instantiates protocol or definition**

 A protocol, guideline, orderset or other definition that was adhered to in whole or in part by this procedure.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definition")]
    pub definition: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_definition")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub definition_ext: Vec<Option<FieldExtension>>,
    /** **A request for this procedure**

 A reference to a resource that contains details of the request for this procedure.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basedOn")]
    pub based_on: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_basedOn")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub based_on_ext: Vec<Option<FieldExtension>>,
    /** **Part of referenced event**

 A larger event of which this particular procedure is a component or step.

 The MedicationAdministration has a partOf reference to Procedure, but this is not a circular reference.  For a surgical procedure, the anesthesia related medicationAdministration is part of the procedure.  For an IV medication administration,  the procedure to insert the IV port is part of the medication administration. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "partOf")]
    pub part_of: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_partOf")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub part_of_ext: Vec<Option<FieldExtension>>,
    /** **[ProcedureStatus](http://hl7.org/fhir/ValueSet/event-status); preparation | in-progress | suspended | aborted | completed | entered-in-error | unknown**

 A code specifying the state of the procedure. Generally this will be in-progress or completed state.

 The unknown code is not to be used to convey other statuses.  The unknown code should be used when one of the statuses applies, but the authoring system doesn't know the current state of the procedure.

This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::EventStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **True if procedure was not performed as scheduled**

 Set this to true if the record is saying that the procedure was NOT performed.

 If true, it means the procedure did not occur as described.  Typically it would be accompanied by attributes describing the type of activity.  It might also be accompanied by body site information or time information (i.e. no procedure was done to the left arm or no procedure was done in this 2-year period).  Specifying additional information such as performer, outcome, etc. is generally inappropriate.  For example, it's not that useful to say "There was no appendectomy done at 12:03pm June 6th by Dr. Smith with a successful outcome" as it implies that there *could* have been an appendectomy done at any other time, by any other clinician or with any other outcome.

This element is labeled as a modifier because it indicates that a procedure didn't happen. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "notDone")]
    pub not_done: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_notDone")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub not_done_ext: Option<FieldExtension>,
    /** **[ProcedureNegationReason](http://hl7.org/fhir/ValueSet/procedure-not-performed-reason); Reason procedure was not performed**

 A code indicating why the procedure was not performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "notDoneReason")]
    pub not_done_reason: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_notDoneReason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub not_done_reason_ext: Option<FieldExtension>,
    /** **[ProcedureCategory](http://hl7.org/fhir/ValueSet/procedure-category); Classification of the procedure**

 A code that classifies the procedure for searching, sorting and display purposes (e.g. "Surgical Procedure").

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[ProcedureCode](http://hl7.org/fhir/ValueSet/procedure-code); Identification of the procedure**

 The specific procedure that is performed. Use text if the exact nature of the procedure cannot be coded (e.g. "Laparoscopic Appendectomy").

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Who the procedure was performed on**

 The person, animal or group on which the procedure was performed.

 */
    #[serde(rename = "subject")]
    pub subject: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Encounter or episode associated with the procedure**

 The encounter during which the procedure was performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **Date/Period the procedure was performed**

 The date(time)/period over which the procedure was performed. Allows a period to support complex procedures that span more than one date, and also allows for the length of the procedure to be captured.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub performed: Option<ProcedurePerformed>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub performed_ext: Option<ProcedurePerformedExtension>,
    /** **The people who performed the procedure**

 Limited to 'real' people rather than equipment.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Vec<Option<ProcedurePerformer>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_performer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub performer_ext: Vec<Option<FieldExtension>>,
    /** **Where the procedure happened**

 The location where the procedure actually happened.  E.g. a newborn at home, a tracheostomy at a restaurant.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "location")]
    pub location: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_location")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub location_ext: Option<FieldExtension>,
    /** **[ProcedureReason](http://hl7.org/fhir/ValueSet/procedure-reason); Coded reason procedure performed**

 The coded reason why the procedure was performed. This may be coded entity of some type, or may simply be present as text.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonCode")]
    pub reason_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_code_ext: Vec<Option<FieldExtension>>,
    /** **Condition that is the reason the procedure performed**

 The condition that is the reason why the procedure was performed.

 e.g. endoscopy for dilatation and biopsy, combination diagnosis and therapeutic. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonReference")]
    pub reason_reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_reference_ext: Vec<Option<FieldExtension>>,
    /** **[BodySite](http://hl7.org/fhir/ValueSet/body-site); Target body sites**

 Detailed and structured anatomical location information. Multiple locations are allowed - e.g. multiple punch biopsies of a lesion.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "bodySite")]
    pub body_site: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_bodySite")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub body_site_ext: Vec<Option<FieldExtension>>,
    /** **[ProcedureOutcome](http://hl7.org/fhir/ValueSet/procedure-outcome); The result of procedure**

 The outcome of the procedure - did it resolve reasons for the procedure being performed?

 If outcome contains narrative text only, it can be captured using the CodeableConcept.text. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "outcome")]
    pub outcome: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_outcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub outcome_ext: Option<FieldExtension>,
    /** **Any report resulting from the procedure**

 This could be a histology result, pathology report, surgical report, etc..

 There could potentially be multiple reports - e.g. if this was a procedure which took multiple biopsies resulting in a number of anatomical pathology reports. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "report")]
    pub report: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_report")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub report_ext: Vec<Option<FieldExtension>>,
    /** **[ProcedureComplication](http://hl7.org/fhir/ValueSet/condition-code); Complication following the procedure**

 Any complications that occurred during the procedure, or in the immediate post-performance period. These are generally tracked separately from the notes, which will typically describe the procedure itself rather than any 'post procedure' issues.

 If complications are only expressed by the narrative text, they can be captured using the CodeableConcept.text. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "complication")]
    pub complication: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_complication")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub complication_ext: Vec<Option<FieldExtension>>,
    /** **A condition that is a result of the procedure**

 Any complications that occurred during the procedure, or in the immediate post-performance period.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "complicationDetail")]
    pub complication_detail: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_complicationDetail")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub complication_detail_ext: Vec<Option<FieldExtension>>,
    /** **[ProcedureFollowUp](http://hl7.org/fhir/ValueSet/procedure-followup); Instructions for follow up**

 If the procedure required specific follow up - e.g. removal of sutures. The followup may be represented as a simple note, or could potentially be more complex in which case the CarePlan resource can be used.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "followUp")]
    pub follow_up: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_followUp")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub follow_up_ext: Vec<Option<FieldExtension>>,
    /** **Additional information about the procedure**

 Any other notes about the procedure.  E.g. the operative notes.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
    /** **Device changed in procedure**

 A device that is implanted, removed or otherwise manipulated (calibration, battery replacement, fitting a prosthesis, attaching a wound-vac, etc.) as a focal portion of the Procedure.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "focalDevice")]
    pub focal_device: Vec<Option<ProcedureFocalDevice>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_focalDevice")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub focal_device_ext: Vec<Option<FieldExtension>>,
    /** **Items used during procedure**

 Identifies medications, devices and any other substance used as part of the procedure.

 For devices actually implanted or removed, use Procedure.device. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "usedReference")]
    pub used_reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_usedReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub used_reference_ext: Vec<Option<FieldExtension>>,
    /** **[ProcedureUsed](http://hl7.org/fhir/ValueSet/device-kind); Coded items used during the procedure**

 Identifies coded items that were used as part of the procedure.

 For devices actually implanted or removed, use Procedure.device. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "usedCode")]
    pub used_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_usedCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub used_code_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ProcedureBuilder {
    #[doc = concat!("Finalize building ", "Procedure", ".")]
    pub fn build(self) -> Result<Procedure, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ProcedureInner> for Procedure {
    fn from(inner: ProcedureInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Procedure {
    type Target = ProcedureInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Procedure {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Procedure {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ProcedureBuilder {
        ProcedureBuilder::default()
    }
}
impl Procedure {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Procedure
    }
}
/// Choice of types for the performed[x] field in Procedure
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ProcedurePerformed {
    /// Variant accepting the DateTime type.
    #[serde(rename = "performedDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "performedPeriod")]
    Period(Period),
}
/// Extension value for ProcedurePerformed.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ProcedurePerformedExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_performedDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_performedPeriod")]
    Period(FieldExtension),
}
/// Sub-fields of the performer field in Procedure
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ProcedurePerformerBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ProcedurePerformer {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ProcedurePerformerRole](http://hl7.org/fhir/ValueSet/performer-role); The role the actor was in**

 For example: surgeon, anaethetist, endoscopist.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "role")]
    pub role: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_role")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub role_ext: Option<FieldExtension>,
    /** **The reference to the practitioner**

 The practitioner who was involved in the procedure.

 */
    #[serde(rename = "actor")]
    pub actor: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_actor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub actor_ext: Option<FieldExtension>,
    /** **Organization the device or practitioner was acting for**

 The organization the device or practitioner was acting on behalf of.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "onBehalfOf")]
    pub on_behalf_of: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_onBehalfOf")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub on_behalf_of_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ProcedurePerformer {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ProcedurePerformerBuilder {
        ProcedurePerformerBuilder::default()
    }
}
/// Sub-fields of the focalDevice field in Procedure
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ProcedureFocalDeviceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ProcedureFocalDevice {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[DeviceActionKind](http://hl7.org/fhir/ValueSet/device-action); Kind of change to device**

 The kind of change that happened to the device during the procedure.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "action")]
    pub action: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_action")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub action_ext: Option<FieldExtension>,
    /** **Device that was changed**

 The device that was manipulated (changed) during the procedure.

 */
    #[serde(rename = "manipulated")]
    pub manipulated: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_manipulated")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub manipulated_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ProcedureFocalDevice {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ProcedureFocalDeviceBuilder {
        ProcedureFocalDeviceBuilder::default()
    }
}
/** Base StructureDefinition for ProcedureRequest Resource

 **[ProcedureRequest](http://hl7.org/fhir/StructureDefinition/ProcedureRequest) v3.0.2**

 A request for a procedure or diagnostic to be performed

 A record of a request for diagnostic investigations, treatments, or operations to be performed.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ProcedureRequest(pub Box<ProcedureRequestInner>);
/** Base StructureDefinition for ProcedureRequest Resource

 **[ProcedureRequest](http://hl7.org/fhir/StructureDefinition/ProcedureRequest) v3.0.2**

 A request for a procedure or diagnostic to be performed

 A record of a request for diagnostic investigations, treatments, or operations to be performed.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ProcedureRequestBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ProcedureRequestInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ProcedureRequest::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ProcedureRequest", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Identifiers assigned to this order**

 Identifiers assigned to this order instance by the orderer and/or the receiver and/or order fulfiller.

 The identifier.type element is used to distinguish between the identifiers assigned by the orderer (known as the 'Placer' in HL7 v2) and the producer of the observations in response to the order (known as the 'Filler' in HL7 v2).  For further discussion and examples see the resource notes section below. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Protocol or definition**

 Protocol or definition followed by this request.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definition")]
    pub definition: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_definition")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub definition_ext: Vec<Option<FieldExtension>>,
    /** **What request fulfills**

 Plan/proposal/order fulfilled by this request.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basedOn")]
    pub based_on: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_basedOn")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub based_on_ext: Vec<Option<FieldExtension>>,
    /** **What request replaces**

 The request takes the place of the referenced completed or terminated request(s).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "replaces")]
    pub replaces: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_replaces")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub replaces_ext: Vec<Option<FieldExtension>>,
    /** **Composite Request ID**

 A shared identifier common to all procedure or diagnostic requests that were authorized more or less simultaneously by a single author, representing the composite or group identifier.

 Requests are linked either by a "basedOn" relationship (i.e. one request is fulfilling another) or by having a common requisition. Requests that are part of the same requisition are generally treated independently from the perspective of changing their state or maintaining them after initial creation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requisition")]
    pub requisition: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requisition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub requisition_ext: Option<FieldExtension>,
    /** **[ProcedureRequestStatus](http://hl7.org/fhir/ValueSet/request-status); draft | active | suspended | completed | entered-in-error | cancelled**

 The status of the order.

 The status is generally fully in the control of the requester - they determine whether the order is draft or active and, after it has been activated, competed, cancelled or suspended. States relating to the activities of the performer are reflected on either the corresponding event (see [Event Pattern](event.html) for general discussion) or using the [Task](task.html) resource.

This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::RequestStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[ProcedureRequestIntent](http://hl7.org/fhir/ValueSet/request-intent); proposal | plan | order +**

 Whether the request is a proposal, plan, an original order or a reflex order.

 This element is labeled as a modifier because the intent alters when and how the resource is actually applicable. */
    #[serde(rename = "intent")]
    pub intent: codes::RequestIntent,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_intent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub intent_ext: Option<FieldExtension>,
    /** **[ProcedureRequestPriority](http://hl7.org/fhir/ValueSet/request-priority); routine | urgent | asap | stat**

 Indicates how quickly the ProcedureRequest should be addressed with respect to other requests.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "priority")]
    pub priority: Option<codes::RequestPriority>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_priority")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub priority_ext: Option<FieldExtension>,
    /** **True if procedure should not be performed**

 Set this to true if the record is saying that the procedure should NOT be performed.

 This element is labeled as a [modifier](conformance-rules.html#isModifier.html) because it indicates that a procedure shouldn't happen, instead of a request for it to happen.  In general, only the code and timeframe will be present, though occasional additional qualifiers such as body site or even performer could be included to narrow the scope of the prohibition.  If the ProcedureRequest.code and ProcedureRequest.doNotPerform both contain negation, that will reinforce prohibition and should not have a double negative interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "doNotPerform")]
    pub do_not_perform: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_doNotPerform")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub do_not_perform_ext: Option<FieldExtension>,
    /** **[ProcedureRequestCategory](http://hl7.org/fhir/ValueSet/procedure-category); Classification of procedure**

 A code that classifies the procedure for searching, sorting and display purposes (e.g. "Surgical Procedure").

 There may be multiple axis of categorization depending on the context or use case for retrieving or displaying the resource.  The level of granularity is defined by the category concepts in the value set. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub category_ext: Vec<Option<FieldExtension>>,
    /** **[ProcedureRequestCode](http://hl7.org/fhir/ValueSet/procedure-code); What is being requested/ordered**

 A code that identifies a particular procedure, diagnostic investigation, or panel of investigations, that have been requested.

 Many laboratory and radiology procedure codes embed the specimen/organ system in the test ordeer name, for example,  serum or serum/plasma glucose, or a chest xray. The specimen may not be recorded separately from the test code. */
    #[serde(rename = "code")]
    pub code: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Individual the service is ordered for**

 On whom or what the procedure or diagnostic is to be performed. This is usually a human patient, but can also be requested on animals, groups of humans or animals, devices such as dialysis machines, or even locations (typically for environmental scans).

 */
    #[serde(rename = "subject")]
    pub subject: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Encounter or Episode during which request was created**

 An encounter or episode of care that provides additional information about the healthcare context in which this request is made.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **When procedure should occur**

 The date/time at which the diagnostic testing should occur.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub occurrence: Option<ProcedureRequestOccurrence>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub occurrence_ext: Option<ProcedureRequestOccurrenceExtension>,
    /** **Preconditions for procedure or diagnostic**

 If a CodeableConcept is present, it indicates the pre-condition for performing the procedure.  For example "pain", "on flare-up", etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub as_needed: Option<ProcedureRequestAsNeeded>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub as_needed_ext: Option<ProcedureRequestAsNeededExtension>,
    /** **Date request signed**

 When the request transitioned to being actionable.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authoredOn")]
    pub authored_on: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_authoredOn")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub authored_on_ext: Option<FieldExtension>,
    /** **Who/what is requesting procedure or diagnostic**

 The individual who initiated the request and has responsibility for its activation.

 This not the dispatcher, but rather who is the authorizer. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requester")]
    pub requester: Option<ProcedureRequestRequester>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requester")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub requester_ext: Option<FieldExtension>,
    /** **[ProcedureRequestParticipantRole](http://hl7.org/fhir/ValueSet/participant-role); Performer role**

 Desired type of performer for doing the diagnostic testing.

 this is a  role, not  a participation type.  I.e. does not describe the task, but describes the capacity.  For example, “compounding pharmacy” or “psychiatrist” or “internal referral”. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performerType")]
    pub performer_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_performerType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub performer_type_ext: Option<FieldExtension>,
    /** **Requested perfomer**

 The desired perfomer for doing the diagnostic testing.  For example, the surgeon, dermatopathologist, endoscopist, etc.

 If needed, use an [extension](extensibility.html) for listing alternative performers and/or roles and/or preference. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_performer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub performer_ext: Option<FieldExtension>,
    /** **[ProcedureRequestReason](http://hl7.org/fhir/ValueSet/procedure-reason); Explanation/Justification for test**

 An explanation or justification for why this diagnostic investigation is being requested in coded or textual form.   This is often for billing purposes.  May relate to the resources referred to in supportingInformation.

 This may be used to decide how the diagnostic investigation will be performed, or even if it will be performed at all.   Use CodeableConcept text element if the data is free (uncoded) text as shown in the [CT Scan example](procedurerequest-example-di.html). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonCode")]
    pub reason_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_code_ext: Vec<Option<FieldExtension>>,
    /** **Explanation/Justification for test**

 Indicates another resource that provides a justification for why this diagnostic investigation is being requested.   May relate to the resources referred to in supportingInformation.

 This may be used to decide how the diagnostic investigation will be performed, or even if it will be performed at all.   Use CodeableConcept text element if the data is free (uncoded) text as shown in the [CT Scan example](procedurerequest-example-di.html). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonReference")]
    pub reason_reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_reference_ext: Vec<Option<FieldExtension>>,
    /** **Additional clinical information**

 Additional clinical information about the patient or specimen that may influence the procedure or diagnostics or their interpretations.     This information includes diagnosis, clinical findings and other observations.  In laboratory ordering these are typically referred to as "ask at order entry questions (AOEs)".  This includes observations explicitly requested by the producer (filler) to provide context or supporting information needed to complete the order. For example,  reporting the amount of inspired oxygen for blood gas measurements.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "supportingInfo")]
    pub supporting_info: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_supportingInfo")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub supporting_info_ext: Vec<Option<FieldExtension>>,
    /** **Procedure Samples**

 One or more specimens that the laboratory procedure will use.

 Many diagnostic procedures need a specimen, but the request itself is not actually about the specimen. This element is for when the diagnostic is requested on already existing specimens and the request points to the specimen it applies to.    Conversely, If the request is entered first with an unknown specimen, The [Specimen](specimen.html) resource references to the ProcedureRequest. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "specimen")]
    pub specimen: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_specimen")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub specimen_ext: Vec<Option<FieldExtension>>,
    /** **[BodySite](http://hl7.org/fhir/ValueSet/body-site); Location on Body**

 Anatomic location where the procedure should be performed. This is the target site.

 Only used if not implicit in the code found in ProcedureRequest.type.  If the use case requires BodySite to be handled as a separate resource instead of an inline coded element (e.g. to identify and track separately)  then use the standard extension [procedurerequest-targetBodySite](extension-procedurerequest-targetbodysite.html). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "bodySite")]
    pub body_site: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_bodySite")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub body_site_ext: Vec<Option<FieldExtension>>,
    /** **Comments**

 Any other notes and comments made about the service request. For example, letting provider know that "patient hates needles" or other provider instructions.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
    /** **Request provenance**

 Key events in the history of the request.

 This may not include provenances for all versions of the request – only those deemed “relevant” or important.
This SHALL NOT include the Provenance associated with this current version of the resource.  (If that provenance is deemed to be a “relevant” change, it will need to be added as part of a later update.  Until then, it can be queried directly as the Provenance that points to this version using _revinclude
All Provenances should have some historical version of this Request as their subject. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relevantHistory")]
    pub relevant_history: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_relevantHistory")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub relevant_history_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ProcedureRequestBuilder {
    #[doc = concat!("Finalize building ", "ProcedureRequest", ".")]
    pub fn build(self) -> Result<ProcedureRequest, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ProcedureRequestInner> for ProcedureRequest {
    fn from(inner: ProcedureRequestInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ProcedureRequest {
    type Target = ProcedureRequestInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ProcedureRequest {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ProcedureRequest {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ProcedureRequestBuilder {
        ProcedureRequestBuilder::default()
    }
}
impl ProcedureRequest {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ProcedureRequest
    }
}
/// Choice of types for the occurrence[x] field in ProcedureRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ProcedureRequestOccurrence {
    /// Variant accepting the DateTime type.
    #[serde(rename = "occurrenceDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "occurrencePeriod")]
    Period(Period),
    /// Variant accepting the Timing type.
    #[serde(rename = "occurrenceTiming")]
    Timing(Timing),
}
/// Extension value for ProcedureRequestOccurrence.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ProcedureRequestOccurrenceExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_occurrenceDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_occurrencePeriod")]
    Period(FieldExtension),
    /// Variant accepting the Timing extension.
    #[serde(rename = "_occurrenceTiming")]
    Timing(FieldExtension),
}
/// Choice of types for the asNeeded[x] field in ProcedureRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ProcedureRequestAsNeeded {
    /// Variant accepting the Boolean type.
    #[serde(rename = "asNeededBoolean")]
    Boolean(bool),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "asNeededCodeableConcept")]
    CodeableConcept(CodeableConcept),
}
/// Extension value for ProcedureRequestAsNeeded.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ProcedureRequestAsNeededExtension {
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_asNeededBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_asNeededCodeableConcept")]
    CodeableConcept(FieldExtension),
}
/// Sub-fields of the requester field in ProcedureRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ProcedureRequestRequesterBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ProcedureRequestRequester {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Individual making the request**

 The device, practitioner or organization who initiated the request.

 */
    #[serde(rename = "agent")]
    pub agent: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_agent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub agent_ext: Option<FieldExtension>,
    /** **Organization agent is acting for**

 The organization the device or practitioner was acting on behalf of.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "onBehalfOf")]
    pub on_behalf_of: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_onBehalfOf")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub on_behalf_of_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ProcedureRequestRequester {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ProcedureRequestRequesterBuilder {
        ProcedureRequestRequesterBuilder::default()
    }
}
/** Base StructureDefinition for ProcessRequest Resource

 **[ProcessRequest](http://hl7.org/fhir/StructureDefinition/ProcessRequest) v3.0.2**

 Request to perform some action on or in regards to an existing resource

 This resource provides the target, request and response, and action details for an action to be performed by the target on or about existing resources.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ProcessRequest(pub Box<ProcessRequestInner>);
/** Base StructureDefinition for ProcessRequest Resource

 **[ProcessRequest](http://hl7.org/fhir/StructureDefinition/ProcessRequest) v3.0.2**

 Request to perform some action on or in regards to an existing resource

 This resource provides the target, request and response, and action details for an action to be performed by the target on or about existing resources.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ProcessRequestBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ProcessRequestInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ProcessRequest::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ProcessRequest", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business Identifier**

 The ProcessRequest business identifier.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[ProcessRequestStatus](http://hl7.org/fhir/ValueSet/fm-status); active | cancelled | draft | entered-in-error**

 The status of the resource instance.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[ActionList](http://hl7.org/fhir/ValueSet/actionlist); cancel | poll | reprocess | status**

 The type of processing action being requested, for example Reversal, Readjudication, StatusRequest,PendedRequest.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "action")]
    pub action: Option<codes::ActionList>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_action")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub action_ext: Option<FieldExtension>,
    /** **Party which is the target of the request**

 The organization which is the target of the request.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "target")]
    pub target: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_target")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub target_ext: Option<FieldExtension>,
    /** **Creation date**

 The date when this resource was created.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "created")]
    pub created: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_created")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub created_ext: Option<FieldExtension>,
    /** **Responsible practitioner**

 The practitioner who is responsible for the action specified in this request.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "provider")]
    pub provider: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_provider")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub provider_ext: Option<FieldExtension>,
    /** **Responsible organization**

 The organization which is responsible for the action speccified in this request.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "organization")]
    pub organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_organization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub organization_ext: Option<FieldExtension>,
    /** **Reference to the Request resource**

 Reference of resource which is the target or subject of this action.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "request")]
    pub request: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_request")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_ext: Option<FieldExtension>,
    /** **Reference to the Response resource**

 Reference of a prior response to resource which is the target or subject of this action.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "response")]
    pub response: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_response")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub response_ext: Option<FieldExtension>,
    /** **Remove history**

 If true remove all history excluding audit.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "nullify")]
    pub nullify: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_nullify")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub nullify_ext: Option<FieldExtension>,
    /** **Reference number/string**

 A reference to supply which authenticates the process.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reference")]
    pub reference: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reference")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reference_ext: Option<FieldExtension>,
    /** **Items to re-adjudicate**

 List of top level items to be re-adjudicated, if none specified then the entire submission is re-adjudicated.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "item")]
    pub item: Vec<Option<ProcessRequestItem>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_item")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub item_ext: Vec<Option<FieldExtension>>,
    /** **Resource type(s) to include**

 Names of resource types to include.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "include")]
    pub include: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_include")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub include_ext: Vec<Option<FieldExtension>>,
    /** **Resource type(s) to exclude**

 Names of resource types to exclude.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "exclude")]
    pub exclude: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_exclude")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub exclude_ext: Vec<Option<FieldExtension>>,
    /** **Selection period**

 A period of time during which the fulfilling resources would have been created.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ProcessRequestBuilder {
    #[doc = concat!("Finalize building ", "ProcessRequest", ".")]
    pub fn build(self) -> Result<ProcessRequest, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ProcessRequestInner> for ProcessRequest {
    fn from(inner: ProcessRequestInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ProcessRequest {
    type Target = ProcessRequestInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ProcessRequest {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ProcessRequest {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ProcessRequestBuilder {
        ProcessRequestBuilder::default()
    }
}
impl ProcessRequest {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ProcessRequest
    }
}
/// Sub-fields of the item field in ProcessRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ProcessRequestItemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ProcessRequestItem {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Service instance**

 A service line number.

 */
    #[serde(rename = "sequenceLinkId")]
    pub sequence_link_id: i32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sequenceLinkId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sequence_link_id_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ProcessRequestItem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ProcessRequestItemBuilder {
        ProcessRequestItemBuilder::default()
    }
}
/** Base StructureDefinition for ProcessResponse Resource

 **[ProcessResponse](http://hl7.org/fhir/StructureDefinition/ProcessResponse) v3.0.2**

 ProcessResponse resource

 This resource provides processing status, errors and notes from the processing of a resource.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ProcessResponse(pub Box<ProcessResponseInner>);
/** Base StructureDefinition for ProcessResponse Resource

 **[ProcessResponse](http://hl7.org/fhir/StructureDefinition/ProcessResponse) v3.0.2**

 ProcessResponse resource

 This resource provides processing status, errors and notes from the processing of a resource.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ProcessResponseBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ProcessResponseInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ProcessResponse::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ProcessResponse", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business Identifier**

 The Response business identifier.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[ProcessResponseStatus](http://hl7.org/fhir/ValueSet/fm-status); active | cancelled | draft | entered-in-error**

 The status of the resource instance.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **Creation date**

 The date when the enclosed suite of services were performed or completed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "created")]
    pub created: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_created")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub created_ext: Option<FieldExtension>,
    /** **Authoring Organization**

 The organization who produced this adjudicated response.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "organization")]
    pub organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_organization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub organization_ext: Option<FieldExtension>,
    /** **Request reference**

 Original request resource reference.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "request")]
    pub request: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_request")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_ext: Option<FieldExtension>,
    /** **[ProcessingOutcome](http://hl7.org/fhir/ValueSet/process-outcome); Processing outcome**

 Transaction status: error, complete, held.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "outcome")]
    pub outcome: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_outcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub outcome_ext: Option<FieldExtension>,
    /** **Disposition Message**

 A description of the status of the adjudication or processing.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "disposition")]
    pub disposition: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_disposition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub disposition_ext: Option<FieldExtension>,
    /** **Responsible Practitioner**

 The practitioner who is responsible for the services rendered to the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requestProvider")]
    pub request_provider: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requestProvider")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_provider_ext: Option<FieldExtension>,
    /** **Responsible organization**

 The organization which is responsible for the services rendered to the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requestOrganization")]
    pub request_organization: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requestOrganization")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_organization_ext: Option<FieldExtension>,
    /** **[Forms](http://hl7.org/fhir/ValueSet/forms); Printed Form Identifier**

 The form to be used for printing the content.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "form")]
    pub form: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_form")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub form_ext: Option<FieldExtension>,
    /** **Processing comments or additional requirements**

 Suite of processing notes or additional requirements if the processing has been held.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "processNote")]
    pub process_note: Vec<Option<ProcessResponseProcessNote>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_processNote")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub process_note_ext: Vec<Option<FieldExtension>>,
    /** **[AdjudicationError](http://hl7.org/fhir/ValueSet/adjudication-error); Error code**

 Processing errors.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "error")]
    pub error: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_error")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub error_ext: Vec<Option<FieldExtension>>,
    /** **Request for additional information**

 Request for additional supporting or authorizing information, such as: documents, images or resources.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "communicationRequest")]
    pub communication_request: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_communicationRequest")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub communication_request_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ProcessResponseBuilder {
    #[doc = concat!("Finalize building ", "ProcessResponse", ".")]
    pub fn build(self) -> Result<ProcessResponse, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ProcessResponseInner> for ProcessResponse {
    fn from(inner: ProcessResponseInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ProcessResponse {
    type Target = ProcessResponseInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ProcessResponse {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ProcessResponse {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ProcessResponseBuilder {
        ProcessResponseBuilder::default()
    }
}
impl ProcessResponse {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ProcessResponse
    }
}
/// Sub-fields of the processNote field in ProcessResponse
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ProcessResponseProcessNoteBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ProcessResponseProcessNote {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[NoteType](http://hl7.org/fhir/ValueSet/note-type); display | print | printoper**

 The note purpose: Print/Display.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Comment on the processing**

 The note text.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_text")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub text_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ProcessResponseProcessNote {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ProcessResponseProcessNoteBuilder {
        ProcessResponseProcessNoteBuilder::default()
    }
}
/** Base StructureDefinition for Provenance Resource

 **[Provenance](http://hl7.org/fhir/StructureDefinition/Provenance) v3.0.2**

 Who, What, When for a set of resources

 Provenance of a resource is a record that describes entities and processes involved in producing and delivering or otherwise influencing that resource. Provenance provides a critical foundation for assessing authenticity, enabling trust, and allowing reproducibility. Provenance assertions are a form of contextual metadata and can themselves become important records with their own provenance. Provenance statement indicates clinical significance in terms of confidence in authenticity, reliability, and trustworthiness, integrity, and stage in lifecycle (e.g. Document Completion - has the artifact been legally authenticated), all of which may impact security, privacy, and trust policies.

 Some parties may be duplicated between the target resource and its provenance.  For instance, the prescriber is usually (but not always) the author of the prescription resource. This resource is defined with close consideration for W3C Provenance. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Provenance(pub Box<ProvenanceInner>);
/** Base StructureDefinition for Provenance Resource

 **[Provenance](http://hl7.org/fhir/StructureDefinition/Provenance) v3.0.2**

 Who, What, When for a set of resources

 Provenance of a resource is a record that describes entities and processes involved in producing and delivering or otherwise influencing that resource. Provenance provides a critical foundation for assessing authenticity, enabling trust, and allowing reproducibility. Provenance assertions are a form of contextual metadata and can themselves become important records with their own provenance. Provenance statement indicates clinical significance in terms of confidence in authenticity, reliability, and trustworthiness, integrity, and stage in lifecycle (e.g. Document Completion - has the artifact been legally authenticated), all of which may impact security, privacy, and trust policies.

 Some parties may be duplicated between the target resource and its provenance.  For instance, the prescriber is usually (but not always) the author of the prescription resource. This resource is defined with close consideration for W3C Provenance. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ProvenanceBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ProvenanceInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Provenance::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Provenance", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Target Reference(s) (usually version specific)**

 The Reference(s) that were generated or updated by  the activity described in this resource. A provenance can point to more than one target if multiple resources were created/updated by the same activity.

 Target references are usually version specific, but may not be, if a version has not been assigned or if the provenance information is part of the set of resources being maintained (i.e. a document). When using the RESTful API, the identity of the resource may not be known (especially not the version specific one); the client may either submit the resource first, and then the provenance, or it may submit both using a single transaction. See the notes on transaction for further discussion. */
    #[serde(rename = "target")]
    pub target: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_target")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub target_ext: Vec<Option<FieldExtension>>,
    /** **When the activity occurred**

 The period during which the activity occurred.

 The period can be a little arbitrary; where possible, the time should correspond to human assessment of the activity time. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
    /** **When the activity was recorded / updated**

 The instant of time at which the activity was recorded.

 This can be a little different from the time stamp on the resource if there is a delay between recording the event and updating the provenance and target resource. */
    #[serde(rename = "recorded")]
    pub recorded: Instant,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_recorded")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub recorded_ext: Option<FieldExtension>,
    /** **Policy or plan the activity was defined by**

 Policy or plan the activity was defined by. Typically, a single activity may have multiple applicable policy documents, such as patient consent, guarantor funding, etc.

 For example: Where an OAuth token authorizes, the unique identifier from the OAuth token is placed into the policy element Where a policy engine (e.g. XACML) holds policy logic, the unique policy identifier is placed into the policy element. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "policy")]
    pub policy: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_policy")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub policy_ext: Vec<Option<FieldExtension>>,
    /** **Where the activity occurred, if relevant**

 Where the activity occurred, if relevant.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "location")]
    pub location: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_location")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub location_ext: Option<FieldExtension>,
    /** **[ProvenanceReason](http://hl7.org/fhir/ValueSet/v3-PurposeOfUse); Reason the activity is occurring**

 The reason that the activity was taking place.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reason")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_ext: Vec<Option<FieldExtension>>,
    /** **[ProvenanceActivity](http://hl7.org/fhir/ValueSet/provenance-activity-type); Activity that occurred**

 An activity is something that occurs over a period of time and acts upon or with entities; it may include consuming, processing, transforming, modifying, relocating, using, or generating entities.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "activity")]
    pub activity: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_activity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub activity_ext: Option<FieldExtension>,
    /** **Actor involved**

 An actor taking a role in an activity  for which it can be assigned some degree of responsibility for the activity taking place.

 Several agents may be associated (i.e. has some responsibility for an activity) with an activity and vice-versa. */
    #[serde(rename = "agent")]
    pub agent: Vec<Option<ProvenanceAgent>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_agent")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub agent_ext: Vec<Option<FieldExtension>>,
    /** **An entity used in this activity**

 An entity used in this activity.

 Multiple userIds may be associated with the same Practitioner or other individual across various appearances, each with distinct privileges. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "entity")]
    pub entity: Vec<Option<ProvenanceEntity>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_entity")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub entity_ext: Vec<Option<FieldExtension>>,
    /** **Signature on target**

 A digital signature on the target Reference(s). The signer should match a Provenance.agent. The purpose of the signature is indicated.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "signature")]
    pub signature: Vec<Option<Signature>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_signature")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub signature_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ProvenanceBuilder {
    #[doc = concat!("Finalize building ", "Provenance", ".")]
    pub fn build(self) -> Result<Provenance, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ProvenanceInner> for Provenance {
    fn from(inner: ProvenanceInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Provenance {
    type Target = ProvenanceInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Provenance {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Provenance {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ProvenanceBuilder {
        ProvenanceBuilder::default()
    }
}
impl Provenance {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Provenance
    }
}
/// Sub-fields of the agent field in Provenance
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ProvenanceAgentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ProvenanceAgent {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ProvenanceAgentRole](http://hl7.org/fhir/ValueSet/security-role-type); What the agents role was**

 The function of the agent with respect to the activity. The security role enabling the agent with respect to the activity.

 For example: author, performer, enterer, attester, doctor, nurse, clerk, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "role")]
    pub role: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_role")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub role_ext: Vec<Option<FieldExtension>>,
    /** **Who participated**

 The individual, device or organization that participated in the event.

 */
    #[serde(flatten)]
    pub who: ProvenanceAgentWho,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub who_ext: Option<ProvenanceAgentWhoExtension>,
    /** **Who the agent is representing**

 The individual, device, or organization for whom the change was made.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub on_behalf_of: Option<ProvenanceAgentOnBehalfOf>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub on_behalf_of_ext: Option<ProvenanceAgentOnBehalfOfExtension>,
    /** **[RelatedAgentType](http://hl7.org/fhir/ValueSet/v3-RoleLinkType); Type of relationship between agents**

 The type of relationship between agents.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relatedAgentType")]
    pub related_agent_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_relatedAgentType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub related_agent_type_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ProvenanceAgent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ProvenanceAgentBuilder {
        ProvenanceAgentBuilder::default()
    }
}
/// Choice of types for the who[x] field in ProvenanceAgent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ProvenanceAgentWho {
    /// Variant accepting the Uri type.
    #[serde(rename = "whoUri")]
    Uri(String),
    /// Variant accepting the Reference type.
    #[serde(rename = "whoReference")]
    Reference(Reference),
}
/// Extension value for ProvenanceAgentWho.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ProvenanceAgentWhoExtension {
    /// Variant accepting the Uri extension.
    #[serde(rename = "_whoUri")]
    Uri(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_whoReference")]
    Reference(FieldExtension),
}
/// Choice of types for the onBehalfOf[x] field in ProvenanceAgent
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ProvenanceAgentOnBehalfOf {
    /// Variant accepting the Uri type.
    #[serde(rename = "onBehalfOfUri")]
    Uri(String),
    /// Variant accepting the Reference type.
    #[serde(rename = "onBehalfOfReference")]
    Reference(Reference),
}
/// Extension value for ProvenanceAgentOnBehalfOf.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ProvenanceAgentOnBehalfOfExtension {
    /// Variant accepting the Uri extension.
    #[serde(rename = "_onBehalfOfUri")]
    Uri(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_onBehalfOfReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the entity field in Provenance
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ProvenanceEntityBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ProvenanceEntity {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ProvenanceEntityRole](http://hl7.org/fhir/ValueSet/provenance-entity-role); derivation | revision | quotation | source | removal**

 How the entity was used during the activity.

 */
    #[serde(rename = "role")]
    pub role: codes::ProvenanceEntityRole,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_role")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub role_ext: Option<FieldExtension>,
    /** **Identity of entity**

 Identity of the  Entity used. May be a logical or physical uri and maybe absolute or relative.

 Identity may be a reference to a resource or to something else, depending on the type. */
    #[serde(flatten)]
    pub what: ProvenanceEntityWhat,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub what_ext: Option<ProvenanceEntityWhatExtension>,
    /** **Entity is attributed to this agent**

 The entity is attributed to an agent to express the agent's responsibility for that entity, possibly along with other agents. This description can be understood as shorthand for saying that the agent was responsible for the activity which generated the entity.

 A usecase where one Provenance.entity.agent is used where the Entity that was used in the creation/updating of the Target, is not in the context of the same custodianship as the Target, and thus the meaning of Provenance.entity.agent is to say that the entity referenced is managed elsewhere and that this Agent provided access to it.  This would be similar to where the Entity being referenced is managed outside FHIR, such as through HL7 v2, v3, or XDS. This might be where the Entity being referenced is managed in another FHIR resource server. Thus it explains the Provenance of that Entity's use in the context of this Provenance activity. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "agent")]
    pub agent: Vec<Option<ProvenanceAgent>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_agent")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub agent_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ProvenanceEntity {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ProvenanceEntityBuilder {
        ProvenanceEntityBuilder::default()
    }
}
/// Choice of types for the what[x] field in ProvenanceEntity
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ProvenanceEntityWhat {
    /// Variant accepting the Uri type.
    #[serde(rename = "whatUri")]
    Uri(String),
    /// Variant accepting the Reference type.
    #[serde(rename = "whatReference")]
    Reference(Reference),
    /// Variant accepting the Identifier type.
    #[serde(rename = "whatIdentifier")]
    Identifier(Identifier),
}
/// Extension value for ProvenanceEntityWhat.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ProvenanceEntityWhatExtension {
    /// Variant accepting the Uri extension.
    #[serde(rename = "_whatUri")]
    Uri(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_whatReference")]
    Reference(FieldExtension),
    /// Variant accepting the Identifier extension.
    #[serde(rename = "_whatIdentifier")]
    Identifier(FieldExtension),
}
/** Base StructureDefinition for Questionnaire Resource

 **[Questionnaire](http://hl7.org/fhir/StructureDefinition/Questionnaire) v3.0.2**

 A structured set of questions

 A structured set of questions intended to guide the collection of answers from end-users. Questionnaires provide detailed control over order, presentation, phraseology and grouping to allow coherent, consistent data collection.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Questionnaire(pub Box<QuestionnaireInner>);
/** Base StructureDefinition for Questionnaire Resource

 **[Questionnaire](http://hl7.org/fhir/StructureDefinition/Questionnaire) v3.0.2**

 A structured set of questions

 A structured set of questions intended to guide the collection of answers from end-users. Questionnaires provide detailed control over order, presentation, phraseology and grouping to allow coherent, consistent data collection.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "QuestionnaireBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct QuestionnaireInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Questionnaire::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Questionnaire", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical URI to reference this questionnaire (globally unique)**

 An absolute URI that is used to identify this questionnaire when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this questionnaire is (or will be) published. The URL SHOULD include the major version of the questionnaire. For more information see [Technical and Business Versions](resource.html#versions).

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred.  Multiple instances may share the same url if they have a distinct version. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "url")]
    pub url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Additional identifier for the questionnaire**

 A formal identifier that is used to identify this questionnaire when it is represented in other formats, or referenced in a specification, model, design or an instance.

 Typically, this is used for identifiers that can go in an HL7 V3 II (instance identifier) data type, e.g., to identify this questionnaire outside of FHIR, where it is not possible to use the logical URI. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Business version of the questionnaire**

 The identifier that is used to identify this version of the questionnaire when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the questionnaire author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.

 There may be different questionnaire instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a refrence to a particular business version of the questionnaire with the format [url]|[version]. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Name for this questionnaire (computer friendly)**

 A natural language name identifying the questionnaire. This name should be usable as an identifier for the module by machine processing applications such as code generation.

 The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure that it is computable friendly. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Name for this questionnaire (human friendly)**

 A short, descriptive, user-friendly title for the questionnaire.

 This name does not need to be machine-processing friendly and may contain punctuation, white-space, etc. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this questionnaire. Enables tracking the life-cycle of the content.

 Allows filtering of questionnaires that are appropriate for use vs. not.
This is labeled as "Is Modifier" because applications should not use a retired questionnaire without due consideration. */
    #[serde(rename = "status")]
    pub status: codes::PublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **For testing purposes, not real usage**

 A boolean value to indicate that this questionnaire is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of questionnaire that are appropriate for use vs. not. This is labeled as "Is Modifier" because applications should not use an experimental questionnaire in production. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "experimental")]
    pub experimental: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_experimental")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub experimental_ext: Option<FieldExtension>,
    /** **Date this was last changed**

 The date  (and optionally time) when the questionnaire was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the questionnaire changes.

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the questionnaire. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Name of the publisher (organization or individual)**

 The name of the individual or organization that published the questionnaire.

 Usually an organization, but may be an individual. The publisher (or steward) of the questionnaire is the organization or individual primarily responsible for the maintenance and upkeep of the questionnaire. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the questionnaire. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisher")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_ext: Option<FieldExtension>,
    /** **Natural language description of the questionnaire**

 A free text natural language description of the questionnaire from a consumer's perspective.

 This description can be used to capture details such as why the questionnaire was built, comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the questionnaire as conveyed in the 'text' field of the resource itself. This item SHOULD be populated unless the information is available from context (e.g. the language of the profile is presumed to be the predominant language in the place the profile was created). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Why this questionnaire is defined**

 Explaination of why this questionnaire is needed and why it has been designed as it has.

 This element does not describe the usage of the questionnaire Instead  it provides traceability of ''why'' the resource is either needed or ''why'' it is defined as it is.  This may be used to point to source materials or specifications that drove the structure of this questionnaire. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purpose")]
    pub purpose: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_purpose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub purpose_ext: Option<FieldExtension>,
    /** **When the questionnaire was approved by publisher**

 The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.

 The 'date' element may be more recent than the approval date because of minor changes / editorial corrections. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "approvalDate")]
    pub approval_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_approvalDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub approval_date_ext: Option<FieldExtension>,
    /** **When the questionnaire was last reviewed**

 The date on which the resource content was last reviewed. Review happens periodically after approval, but doesn't change the original approval date.

 If specified, this is usually after the approval date. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "lastReviewDate")]
    pub last_review_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_lastReviewDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub last_review_date_ext: Option<FieldExtension>,
    /** **When the questionnaire is expected to be used**

 The period during which the questionnaire content was or is planned to be in active use.

 The effective period for a questionnaire  determines when the content is applicable for usage and is independent of publication and review dates. For example, a measure intended to be used for the year 2016 might be published in 2015. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "effectivePeriod")]
    pub effective_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_effectivePeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub effective_period_ext: Option<FieldExtension>,
    /** **Context the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate questionnaire instances.

 When multiple useContexts are specified, there is no expectation whether all or any of the contexts apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useContext")]
    pub use_context: Vec<Option<UsageContext>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_useContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_context_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Intended jurisdiction for questionnaire (if applicable)**

 A legal or geographic region in which the questionnaire is intended to be used.

 It may be possible for the questionnaire to be used in jurisdictions other than those for which it was originally designed or intended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **Contact details for the publisher**

 Contact details to assist a user in finding and communicating with the publisher.

 May be a web site, an email address, a telephone number, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Use and/or publishing restrictions**

 A copyright statement relating to the questionnaire and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the questionnaire.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyright")]
    pub copyright: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyright")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_ext: Option<FieldExtension>,
    /** **[QuestionnaireConcept](http://hl7.org/fhir/ValueSet/questionnaire-questions); Concept that represents the overall questionnaire**

 An identifier for this question or group of questions in a particular terminology such as LOINC.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub code_ext: Vec<Option<FieldExtension>>,
    /** **[ResourceType](http://hl7.org/fhir/ValueSet/resource-types); Resource that can be subject of QuestionnaireResponse**

 The types of subjects that can be the subject of responses created for the questionnaire.

 If none are specified, then the subject is unlimited. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subjectType")]
    pub subject_type: Vec<Option<codes::ResourceType>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_subjectType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub subject_type_ext: Vec<Option<FieldExtension>>,
    /** **Questions and sections within the Questionnaire**

 A particular question, question grouping or display text that is part of the questionnaire.

 The content of the questionnaire is constructed from an ordered, hierarchical collection of items. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "item")]
    pub item: Vec<Option<QuestionnaireItem>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_item")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub item_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl QuestionnaireBuilder {
    #[doc = concat!("Finalize building ", "Questionnaire", ".")]
    pub fn build(self) -> Result<Questionnaire, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<QuestionnaireInner> for Questionnaire {
    fn from(inner: QuestionnaireInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Questionnaire {
    type Target = QuestionnaireInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Questionnaire {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Questionnaire {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> QuestionnaireBuilder {
        QuestionnaireBuilder::default()
    }
}
impl Questionnaire {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Questionnaire
    }
}
/// Sub-fields of the item field in Questionnaire
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "QuestionnaireItemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct QuestionnaireItem {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Unique id for item in questionnaire**

 An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.

 This ''can'' be a meaningful identifier (e.g. a LOINC code) but is not intended to have any meaning.  GUIDs or sequential numbers are appropriate here. */
    #[serde(rename = "linkId")]
    pub link_id: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_linkId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub link_id_ext: Option<FieldExtension>,
    /** **ElementDefinition - details for the item**

 A reference to an [ElementDefinition](elementdefinition.html) that provides the details for the item. If a definition is provided, then the following element values can be inferred from the definition:

* code (ElementDefinition.code)
* type (ElementDefinition.type)
* required (ElementDefinition.min)
* repeats (ElementDefinition.max)
* maxLength (ElementDefinition.maxLength)
* options (ElementDefinition.binding)

Any information provided in these elements on a Questionnaire Item overrides the information from the definition.

 the URI refers to an ElementDefinition in either a [StructureDefinition](structuredefinition.html#) or a [DataElement](dataelement.html#), and always starts with the canonical URL for the target resource. When referring to a StructureDefinition, a fragment identifier is used to specify the element definition by its id [Element.id](element-definitions.html#Element.id). E.g. http://hl7.org/fhir/StructureDefinition/Observation#Observation.value[x]. In the absence of a fragment identifier, the first/root element definition in the target is the matching element definition. Note that [LOINC codes](loinc.html#dataelements) implicitly define DataElement resources. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definition")]
    pub definition: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_definition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub definition_ext: Option<FieldExtension>,
    /** **[QuestionnaireConcept](http://hl7.org/fhir/ValueSet/questionnaire-questions); Corresponding concept for this item in a terminology**

 A terminology code that corresponds to this group or question (e.g. a code from LOINC, which defines many questions and answers).

 The value may come from the ElementDefinition referred to by .definition. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub code_ext: Vec<Option<FieldExtension>>,
    /** **E.g. "1(a)", "2.5.3"**

 A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.

 These are generally unique within a questionnaire, though this is not guaranteed. Some questionnaires may have multiple questions with the same label with logic to control which gets exposed.

Typically these won't be used for "display" items, though such use is not prohibited.

Systems SHOULD NOT generate their own prefixes if prefixes are defined for any items within a Questionnaire. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "prefix")]
    pub prefix: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_prefix")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub prefix_ext: Option<FieldExtension>,
    /** **Primary text for the item**

 The name of a section, the text of a question or text content for a display item.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_text")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub text_ext: Option<FieldExtension>,
    /** **[QuestionnaireItemType](http://hl7.org/fhir/ValueSet/item-type); group | display | boolean | decimal | integer | date | dateTime +**

 The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, coded choice, etc.).

 Additional constraints on the type of answer can be conveyed by extensions. The value may come from the ElementDefinition referred to by .definition. */
    #[serde(rename = "type")]
    pub r#type: codes::QuestionnaireItemType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Only allow data when**

 A constraint indicating that this item should only be enabled (displayed/allow answers to be captured) when the specified condition is true.

 If multiple repetitions of this extension are present, the item should be enabled when the condition for *any* of the repetitions is true.  I.e. treat "enableWhen"s as being joined by an "or" clause.

This element is a modifier because if enableWhen is present for an item, "required" is ignored unless one of the enableWhen conditions is met. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "enableWhen")]
    pub enable_when: Vec<Option<QuestionnaireItemEnableWhen>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_enableWhen")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub enable_when_ext: Vec<Option<FieldExtension>>,
    /** **Whether the item must be included in data results**

 An indication, if true, that the item must be present in a "completed" QuestionnaireResponse.  If false, the item may be skipped when answering the questionnaire.

 Questionnaire.item.required only has meaning for elements that are conditionally enabled with enableWhen if the condition evaluates to true.  If an item that contains other items is marked as required, that does not automatically make the contained elements required (though required groups must contain at least one child element). The value may come from the ElementDefinition referred to by .definition. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "required")]
    pub required: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_required")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub required_ext: Option<FieldExtension>,
    /** **Whether the item may repeat**

 An indication, if true, that the item may occur multiple times in the response, collecting multiple answers answers for questions or multiple sets of answers for groups.

 If a question is marked as repeats=true, then multiple answers can be provided for the question in the corresponding QuestionnaireResponse.  When rendering the questionnaire, it is up to the rendering software whether to render the question text for each answer repetition or to simply list each of the answers beneath the question.  (Which is most appropriate visually may depend on the type of answer as well as whether there are nested items.). The value may come from the ElementDefinition referred to by .definition. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "repeats")]
    pub repeats: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_repeats")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub repeats_ext: Option<FieldExtension>,
    /** **Don't allow human editing**

 An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.

 The value of readOnly elements can be established by asserting  extensions for defaultValues, linkages that support pre-population and/or extensions that support calculation based on other answers. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "readOnly")]
    pub read_only: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_readOnly")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub read_only_ext: Option<FieldExtension>,
    /** **No more than this many characters**

 The maximum number of characters that are permitted in the answer to be considered a "valid" QuestionnaireResponse.

 For base64binary, reflects the number of characters representing the encoded data, not the number of bytes of the binary data. The value may come from the ElementDefinition referred to by .definition. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "maxLength")]
    pub max_length: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_maxLength")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub max_length_ext: Option<FieldExtension>,
    /** **Valueset containing permitted answers**

 A reference to a value set containing a list of codes representing permitted answers for a "choice" or "open-choice" question.

 LOINC defines many useful value sets for questionnaire responses. See [LOINC Answer Lists](loinc.html#alist). The value may come from the ElementDefinition referred to by .definition. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "options")]
    pub options: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_options")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub options_ext: Option<FieldExtension>,
    /** **Permitted answer**

 One of the permitted answers for a "choice" or "open-choice" question.

 This element can be used when the value set machinery of options is deemed too cumbersome or when there's a need to capture options that are not codes. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "option")]
    pub option: Vec<Option<QuestionnaireItemOption>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_option")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub option_ext: Vec<Option<FieldExtension>>,
    /** **Default value when item is first rendered**

 The value that should be defaulted when initially rendering the questionnaire for user input.

 The user is allowed to change the value and override the default (unless marked as read-only). If the user doesn't change the value, then this initial value will be persisted when the QuestionnaireResponse is initially created.  Note that default values can influence results.

The data type of initial[x] must agree with the item.type. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub initial: Option<QuestionnaireItemInitial>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub initial_ext: Option<QuestionnaireItemInitialExtension>,
    /** **Nested questionnaire items**

 Text, questions and other groups to be nested beneath a question or group.

 There is no specified limit to the depth of nesting.  However, Questionnaire authors are encouraged to consider the impact on the user and user interface of overly deep nesting. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "item")]
    pub item: Vec<Option<QuestionnaireItem>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_item")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub item_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl QuestionnaireItem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> QuestionnaireItemBuilder {
        QuestionnaireItemBuilder::default()
    }
}
/// Sub-fields of the enableWhen field in QuestionnaireItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "QuestionnaireItemEnableWhenBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct QuestionnaireItemEnableWhen {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Question that determines whether item is enabled**

 The linkId for the question whose answer (or lack of answer) governs whether this item is enabled.

 If multiple question occurrences are present for the same question (same linkId), then this refers to the nearest question occurrence reachable by tracing first the "ancestor" axis and then the "preceding" axis and then the "following" axis. */
    #[serde(rename = "question")]
    pub question: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_question")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub question_ext: Option<FieldExtension>,
    /** **Enable when answered or not**

 An indication that this item should be enabled only if the specified question is answered (hasAnswer=true) or not answered (hasAnswer=false).

 If answered=false and answer values are also provided, then they are treated as "or".  I.e. "Enable if the question is unanswered or the answer is one of the specified values".  If answered=true and answers are present, one of the specified answers must be met. (So there's little reason to specify answered=true if answers are present.). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "hasAnswer")]
    pub has_answer: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_hasAnswer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub has_answer_ext: Option<FieldExtension>,
    /** **Value question must have**

 An answer that the referenced question must match in order for the item to be enabled.

 Multiple answers are treated as "or".  E.g. Enable if question 1 = A, C or E.

Components not specified in the answer do not need to match.  For example, if enableWhen specifies code + system for a Coding, it is ok if the answer has a "display" element.  I.e. treat the answer as a 'pattern'.

The dataType of this element must be the same as the data type of the question being referenced. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub answer: Option<QuestionnaireItemEnableWhenAnswer>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub answer_ext: Option<QuestionnaireItemEnableWhenAnswerExtension>,
}
#[cfg(feature = "builders")]
impl QuestionnaireItemEnableWhen {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> QuestionnaireItemEnableWhenBuilder {
        QuestionnaireItemEnableWhenBuilder::default()
    }
}
/// Choice of types for the answer[x] field in QuestionnaireItemEnableWhen
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum QuestionnaireItemEnableWhenAnswer {
    /// Variant accepting the Boolean type.
    #[serde(rename = "answerBoolean")]
    Boolean(bool),
    /// Variant accepting the Decimal type.
    #[serde(rename = "answerDecimal")]
    Decimal(f64),
    /// Variant accepting the Integer type.
    #[serde(rename = "answerInteger")]
    Integer(i32),
    /// Variant accepting the Date type.
    #[serde(rename = "answerDate")]
    Date(Date),
    /// Variant accepting the DateTime type.
    #[serde(rename = "answerDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Time type.
    #[serde(rename = "answerTime")]
    Time(Time),
    /// Variant accepting the String type.
    #[serde(rename = "answerString")]
    String(String),
    /// Variant accepting the Uri type.
    #[serde(rename = "answerUri")]
    Uri(String),
    /// Variant accepting the Attachment type.
    #[serde(rename = "answerAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Coding type.
    #[serde(rename = "answerCoding")]
    Coding(Coding),
    /// Variant accepting the Quantity type.
    #[serde(rename = "answerQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Reference type.
    #[serde(rename = "answerReference")]
    Reference(Reference),
}
/// Extension value for QuestionnaireItemEnableWhenAnswer.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum QuestionnaireItemEnableWhenAnswerExtension {
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_answerBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Decimal extension.
    #[serde(rename = "_answerDecimal")]
    Decimal(FieldExtension),
    /// Variant accepting the Integer extension.
    #[serde(rename = "_answerInteger")]
    Integer(FieldExtension),
    /// Variant accepting the Date extension.
    #[serde(rename = "_answerDate")]
    Date(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_answerDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Time extension.
    #[serde(rename = "_answerTime")]
    Time(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_answerString")]
    String(FieldExtension),
    /// Variant accepting the Uri extension.
    #[serde(rename = "_answerUri")]
    Uri(FieldExtension),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_answerAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_answerCoding")]
    Coding(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_answerQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_answerReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the option field in QuestionnaireItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "QuestionnaireItemOptionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct QuestionnaireItemOption {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Answer value**

 A potential answer that's allowed as the answer to this question.

 The data type of the value must agree with the item.type. */
    #[serde(flatten)]
    pub value: QuestionnaireItemOptionValue,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<QuestionnaireItemOptionValueExtension>,
}
#[cfg(feature = "builders")]
impl QuestionnaireItemOption {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> QuestionnaireItemOptionBuilder {
        QuestionnaireItemOptionBuilder::default()
    }
}
/// Choice of types for the value[x] field in QuestionnaireItemOption
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum QuestionnaireItemOptionValue {
    /// Variant accepting the Integer type.
    #[serde(rename = "valueInteger")]
    Integer(i32),
    /// Variant accepting the Date type.
    #[serde(rename = "valueDate")]
    Date(Date),
    /// Variant accepting the Time type.
    #[serde(rename = "valueTime")]
    Time(Time),
    /// Variant accepting the String type.
    #[serde(rename = "valueString")]
    String(String),
    /// Variant accepting the Coding type.
    #[serde(rename = "valueCoding")]
    Coding(Coding),
}
/// Extension value for QuestionnaireItemOptionValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum QuestionnaireItemOptionValueExtension {
    /// Variant accepting the Integer extension.
    #[serde(rename = "_valueInteger")]
    Integer(FieldExtension),
    /// Variant accepting the Date extension.
    #[serde(rename = "_valueDate")]
    Date(FieldExtension),
    /// Variant accepting the Time extension.
    #[serde(rename = "_valueTime")]
    Time(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_valueString")]
    String(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_valueCoding")]
    Coding(FieldExtension),
}
/// Choice of types for the initial[x] field in QuestionnaireItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum QuestionnaireItemInitial {
    /// Variant accepting the Boolean type.
    #[serde(rename = "initialBoolean")]
    Boolean(bool),
    /// Variant accepting the Decimal type.
    #[serde(rename = "initialDecimal")]
    Decimal(f64),
    /// Variant accepting the Integer type.
    #[serde(rename = "initialInteger")]
    Integer(i32),
    /// Variant accepting the Date type.
    #[serde(rename = "initialDate")]
    Date(Date),
    /// Variant accepting the DateTime type.
    #[serde(rename = "initialDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Time type.
    #[serde(rename = "initialTime")]
    Time(Time),
    /// Variant accepting the String type.
    #[serde(rename = "initialString")]
    String(String),
    /// Variant accepting the Uri type.
    #[serde(rename = "initialUri")]
    Uri(String),
    /// Variant accepting the Attachment type.
    #[serde(rename = "initialAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Coding type.
    #[serde(rename = "initialCoding")]
    Coding(Coding),
    /// Variant accepting the Quantity type.
    #[serde(rename = "initialQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Reference type.
    #[serde(rename = "initialReference")]
    Reference(Reference),
}
/// Extension value for QuestionnaireItemInitial.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum QuestionnaireItemInitialExtension {
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_initialBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Decimal extension.
    #[serde(rename = "_initialDecimal")]
    Decimal(FieldExtension),
    /// Variant accepting the Integer extension.
    #[serde(rename = "_initialInteger")]
    Integer(FieldExtension),
    /// Variant accepting the Date extension.
    #[serde(rename = "_initialDate")]
    Date(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_initialDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Time extension.
    #[serde(rename = "_initialTime")]
    Time(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_initialString")]
    String(FieldExtension),
    /// Variant accepting the Uri extension.
    #[serde(rename = "_initialUri")]
    Uri(FieldExtension),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_initialAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_initialCoding")]
    Coding(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_initialQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_initialReference")]
    Reference(FieldExtension),
}
/** Base StructureDefinition for QuestionnaireResponse Resource

 **[QuestionnaireResponse](http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse) v3.0.2**

 A structured set of questions and their answers

 A structured set of questions and their answers. The questions are ordered and grouped into coherent subsets, corresponding to the structure of the grouping of the questionnaire being responded to.

 The QuestionnaireResponse contains enough information about the questions asked and their organization that it can be interpreted somewhat independently from the Questionnaire it is based on.  I.e. You don't need access to the Questionnaire in order to extract basic information from a QuestionnaireResponse. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct QuestionnaireResponse(pub Box<QuestionnaireResponseInner>);
/** Base StructureDefinition for QuestionnaireResponse Resource

 **[QuestionnaireResponse](http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse) v3.0.2**

 A structured set of questions and their answers

 A structured set of questions and their answers. The questions are ordered and grouped into coherent subsets, corresponding to the structure of the grouping of the questionnaire being responded to.

 The QuestionnaireResponse contains enough information about the questions asked and their organization that it can be interpreted somewhat independently from the Questionnaire it is based on.  I.e. You don't need access to the Questionnaire in order to extract basic information from a QuestionnaireResponse. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "QuestionnaireResponseBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct QuestionnaireResponseInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "QuestionnaireResponse::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::QuestionnaireResponse", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Unique id for this set of answers**

 A business identifier assigned to a particular completed (or partially completed) questionnaire.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **Request fulfilled by this QuestionnaireResponse**

 The order, proposal or plan that is fulfilled in whole or in part by this QuestionnaireResponse.  For example, a ProcedureRequest seeking an intake assessment or a decision support recommendation to assess for post-partum depression.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basedOn")]
    pub based_on: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_basedOn")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub based_on_ext: Vec<Option<FieldExtension>>,
    /** **Part of this action**

 A procedure or observation that this questionnaire was performed as part of the execution of.  For example, the surgery a checklist was executed as part of.

 Composition of questionnaire responses will be handled by the parent questionnaire having answers that reference the child questionnaire.  For relationships to referrals, and other types of requests, use basedOn. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parent")]
    pub parent: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_parent")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub parent_ext: Vec<Option<FieldExtension>>,
    /** **Form being answered**

 The Questionnaire that defines and organizes the questions for which answers are being provided.

 If a QuestionnaireResponse references a Questionnaire, then the QuestionnaireResponse structure must be consistent with the Questionnaire (i.e. questions must be organized into the same groups, nested questions must still be nested, etc.). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "questionnaire")]
    pub questionnaire: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_questionnaire")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub questionnaire_ext: Option<FieldExtension>,
    /** **[QuestionnaireResponseStatus](http://hl7.org/fhir/ValueSet/questionnaire-answers-status); in-progress | completed | amended | entered-in-error | stopped**

 The position of the questionnaire response within its overall lifecycle.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::QuestionnaireResponseStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **The subject of the questions**

 The subject of the questionnaire response.  This could be a patient, organization, practitioner, device, etc.  This is who/what the answers apply to, but is not necessarily the source of information.

 If the Questionnaire declared a subjectType, the resource pointed to by this element must be an instance of one of the listed types. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Encounter or Episode during which questionnaire was completed**

 The encounter or episode of care with primary association to the questionnaire response.

 A questionnaire that was initiated during an encounter but not fully completed during the encounter would still generally be associated with the encounter. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **Date the answers were gathered**

 The date and/or time that this set of answers were last changed.

 May be different from the lastUpdateTime of the resource itself, because that reflects when the data was known to the server, not when the data was captured.

This element is optional to allow for systems that may not know the value, however it SHOULD be populated if possible. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authored")]
    pub authored: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_authored")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub authored_ext: Option<FieldExtension>,
    /** **Person who received and recorded the answers**

 Person who received the answers to the questions in the QuestionnaireResponse and recorded them in the system.

 Mapping a subject's answers to multiple choice options and determining what to put in the textual answer is a matter of interpretation.  Authoring by device would indicate that some portion of the questionnaire had been auto-populated. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_author")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub author_ext: Option<FieldExtension>,
    /** **The person who answered the questions**

 The person who answered the questions about the subject.

 If not specified, no inference can be made about who provided the data. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "source")]
    pub source: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_source")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_ext: Option<FieldExtension>,
    /** **Groups and questions**

 A group or question item from the original questionnaire for which answers are provided.

 Groups cannot have answers and therefore must nest directly within item. When dealing with questions, nesting must occur within each answer because some questions may have multiple answers (and the nesting occurs for each answer). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "item")]
    pub item: Vec<Option<QuestionnaireResponseItem>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_item")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub item_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl QuestionnaireResponseBuilder {
    #[doc = concat!("Finalize building ", "QuestionnaireResponse", ".")]
    pub fn build(self) -> Result<QuestionnaireResponse, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<QuestionnaireResponseInner> for QuestionnaireResponse {
    fn from(inner: QuestionnaireResponseInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for QuestionnaireResponse {
    type Target = QuestionnaireResponseInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for QuestionnaireResponse {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl QuestionnaireResponse {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> QuestionnaireResponseBuilder {
        QuestionnaireResponseBuilder::default()
    }
}
impl QuestionnaireResponse {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::QuestionnaireResponse
    }
}
/// Sub-fields of the item field in QuestionnaireResponse
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "QuestionnaireResponseItemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct QuestionnaireResponseItem {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Pointer to specific item from Questionnaire**

 The item from the Questionnaire that corresponds to this item in the QuestionnaireResponse resource.

 */
    #[serde(rename = "linkId")]
    pub link_id: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_linkId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub link_id_ext: Option<FieldExtension>,
    /** **ElementDefinition - details for the item**

 A reference to an [ElementDefinition](elementdefinition.html) that provides the details for the item.

 The ElementDefinition must be in a [StructureDefinition](structuredefinition.html) or a [DataElement](dataelement.html), and must have a fragment identifier that identifies the specific data element by its id (Element.id). E.g. http://hl7.org/fhir/StructureDefinition/Observation#Observation.value[x].

There is no need for this element if the item pointed to by the linkId has a definition listed. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definition")]
    pub definition: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_definition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub definition_ext: Option<FieldExtension>,
    /** **Name for group or question text**

 Text that is displayed above the contents of the group or as the text of the question being answered.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_text")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub text_ext: Option<FieldExtension>,
    /** **The subject this group's answers are about**

 More specific subject this section's answers are about, details the subject given in QuestionnaireResponse.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **The response(s) to the question**

 The respondent's answer(s) to the question.

 The value is nested because we cannot have a repeating structure that has variable type. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "answer")]
    pub answer: Vec<Option<QuestionnaireResponseItemAnswer>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_answer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub answer_ext: Vec<Option<FieldExtension>>,
    /** **Nested questionnaire response items**

 Questions or sub-groups nested beneath a question or group.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "item")]
    pub item: Vec<Option<QuestionnaireResponseItem>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_item")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub item_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl QuestionnaireResponseItem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> QuestionnaireResponseItemBuilder {
        QuestionnaireResponseItemBuilder::default()
    }
}
/// Sub-fields of the answer field in QuestionnaireResponseItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "QuestionnaireResponseItemAnswerBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct QuestionnaireResponseItemAnswer {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Single-valued answer to the question**

 The answer (or one of the answers) provided by the respondent to the question.

 More complex structures (Attachment, Resource and Quantity) will typically be limited to electronic forms that can expose an appropriate user interface to capture the components and enforce the constraints of a complex data type.  Additional complex types can be introduced through extensions. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<QuestionnaireResponseItemAnswerValue>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<QuestionnaireResponseItemAnswerValueExtension>,
    /** **Nested groups and questions**

 Nested groups and/or questions found within this particular answer.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "item")]
    pub item: Vec<Option<QuestionnaireResponseItem>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_item")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub item_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl QuestionnaireResponseItemAnswer {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> QuestionnaireResponseItemAnswerBuilder {
        QuestionnaireResponseItemAnswerBuilder::default()
    }
}
/// Choice of types for the value[x] field in QuestionnaireResponseItemAnswer
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum QuestionnaireResponseItemAnswerValue {
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// Variant accepting the Decimal type.
    #[serde(rename = "valueDecimal")]
    Decimal(f64),
    /// Variant accepting the Integer type.
    #[serde(rename = "valueInteger")]
    Integer(i32),
    /// Variant accepting the Date type.
    #[serde(rename = "valueDate")]
    Date(Date),
    /// Variant accepting the DateTime type.
    #[serde(rename = "valueDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Time type.
    #[serde(rename = "valueTime")]
    Time(Time),
    /// Variant accepting the String type.
    #[serde(rename = "valueString")]
    String(String),
    /// Variant accepting the Uri type.
    #[serde(rename = "valueUri")]
    Uri(String),
    /// Variant accepting the Attachment type.
    #[serde(rename = "valueAttachment")]
    Attachment(Attachment),
    /// Variant accepting the Coding type.
    #[serde(rename = "valueCoding")]
    Coding(Coding),
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Reference type.
    #[serde(rename = "valueReference")]
    Reference(Reference),
}
/// Extension value for QuestionnaireResponseItemAnswerValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum QuestionnaireResponseItemAnswerValueExtension {
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Decimal extension.
    #[serde(rename = "_valueDecimal")]
    Decimal(FieldExtension),
    /// Variant accepting the Integer extension.
    #[serde(rename = "_valueInteger")]
    Integer(FieldExtension),
    /// Variant accepting the Date extension.
    #[serde(rename = "_valueDate")]
    Date(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_valueDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Time extension.
    #[serde(rename = "_valueTime")]
    Time(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_valueString")]
    String(FieldExtension),
    /// Variant accepting the Uri extension.
    #[serde(rename = "_valueUri")]
    Uri(FieldExtension),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_valueAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_valueCoding")]
    Coding(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_valueReference")]
    Reference(FieldExtension),
}
/** Base StructureDefinition for ReferralRequest Resource

 **[ReferralRequest](http://hl7.org/fhir/StructureDefinition/ReferralRequest) v3.0.2**

 A request for referral or transfer of care

 Used to record and send details about a request for referral service or transfer of a patient to the care of another provider or provider organization.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ReferralRequest(pub Box<ReferralRequestInner>);
/** Base StructureDefinition for ReferralRequest Resource

 **[ReferralRequest](http://hl7.org/fhir/StructureDefinition/ReferralRequest) v3.0.2**

 A request for referral or transfer of care

 Used to record and send details about a request for referral service or transfer of a patient to the care of another provider or provider organization.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ReferralRequestBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ReferralRequestInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ReferralRequest::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ReferralRequest", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business identifier**

 Business identifier that uniquely identifies the referral/care transfer request instance.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Instantiates protocol or definition**

 A protocol, guideline, orderset or other definition that is adhered to in whole or in part by this request.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definition")]
    pub definition: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_definition")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub definition_ext: Vec<Option<FieldExtension>>,
    /** **Request fulfilled by this request**

 Indicates any plans, proposals or orders that this request is intended to satisfy - in whole or in part.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basedOn")]
    pub based_on: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_basedOn")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub based_on_ext: Vec<Option<FieldExtension>>,
    /** **Request(s) replaced by this request**

 Completed or terminated request(s) whose function is taken by this new request.

 The replacement could be because the initial request was immediately rejected (due to an issue) or because the previous request was completed, but the need for the action described by the request remains ongoing. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "replaces")]
    pub replaces: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_replaces")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub replaces_ext: Vec<Option<FieldExtension>>,
    /** **Composite request this is part of**

 The business identifier of the logical "grouping" request/order that this referral is a part of.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "groupIdentifier")]
    pub group_identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_groupIdentifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub group_identifier_ext: Option<FieldExtension>,
    /** **[ReferralRequestStatus](http://hl7.org/fhir/ValueSet/request-status); draft | active | suspended | cancelled | completed | entered-in-error | unknown**

 The status of the authorization/intention reflected by the referral request record.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::RequestStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[ReferralCategory](http://hl7.org/fhir/ValueSet/request-intent); proposal | plan | order**

 Distinguishes the "level" of authorization/demand implicit in this request.

 */
    #[serde(rename = "intent")]
    pub intent: codes::RequestIntent,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_intent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub intent_ext: Option<FieldExtension>,
    /** **[ReferralType](http://hl7.org/fhir/ValueSet/referral-type); Referral/Transition of care request type**

 An indication of the type of referral (or where applicable the type of transfer of care) request.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[ReferralPriority](http://hl7.org/fhir/ValueSet/request-priority); Urgency of referral / transfer of care request**

 An indication of the urgency of referral (or where applicable the type of transfer of care) request.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "priority")]
    pub priority: Option<codes::RequestPriority>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_priority")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub priority_ext: Option<FieldExtension>,
    /** **[RequestedService](http://hl7.org/fhir/ValueSet/c80-practice-codes); Actions requested as part of the referral**

 The service(s) that is/are requested to be provided to the patient.  For example: cardiac pacemaker insertion.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "serviceRequested")]
    pub service_requested: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_serviceRequested")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub service_requested_ext: Vec<Option<FieldExtension>>,
    /** **Patient referred to care or transfer**

 The patient who is the subject of a referral or transfer of care request.

 Referral of family, group or community is to be catered for by profiles. */
    #[serde(rename = "subject")]
    pub subject: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Originating encounter**

 The encounter at which the request for referral or transfer of care is initiated.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **When the service(s) requested in the referral should occur**

 The period of time within which the services identified in the referral/transfer of care is specified or required to occur.

 When the occurrenceDateTime is used, then it is indicating that the requested service must happen before the specified date. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub occurrence: Option<ReferralRequestOccurrence>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub occurrence_ext: Option<ReferralRequestOccurrenceExtension>,
    /** **Date of creation/activation**

 Date/DateTime of creation for draft requests and date of activation for active requests.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authoredOn")]
    pub authored_on: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_authoredOn")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub authored_on_ext: Option<FieldExtension>,
    /** **Who/what is requesting service**

 The individual who initiated the request and has responsibility for its activation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requester")]
    pub requester: Option<ReferralRequestRequester>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requester")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub requester_ext: Option<FieldExtension>,
    /** **[ReferralSpecialty](http://hl7.org/fhir/ValueSet/practitioner-specialty); The clinical specialty (discipline) that the referral is requested for**

 Indication of the clinical domain or discipline to which the referral or transfer of care request is sent.  For example: Cardiology Gastroenterology Diabetology.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "specialty")]
    pub specialty: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_specialty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub specialty_ext: Option<FieldExtension>,
    /** **Receiver of referral / transfer of care request**

 The healthcare provider(s) or provider organization(s) who/which is to receive the referral/transfer of care request.

 There will be a primary receiver. But the request can be received by any number of "copied to" providers or organizations. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recipient")]
    pub recipient: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_recipient")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub recipient_ext: Vec<Option<FieldExtension>>,
    /** **[ReferralReason](http://hl7.org/fhir/ValueSet/clinical-findings); Reason for referral / transfer of care request**

 Description of clinical condition indicating why referral/transfer of care is requested.  For example:  Pathological Anomalies, Disabled (physical or mental),  Behavioral Management.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonCode")]
    pub reason_code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonCode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_code_ext: Vec<Option<FieldExtension>>,
    /** **Why is service needed?**

 Indicates another resource whose existence justifies this request.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonReference")]
    pub reason_reference: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_reasonReference")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub reason_reference_ext: Vec<Option<FieldExtension>>,
    /** **A textual description of the referral**

 The reason element gives a short description of why the referral is being made, the description expands on this to support a more complete clinical summary.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Additonal information to support referral or transfer of care request**

 Any additional (administrative, financial or clinical) information required to support request for referral or transfer of care.  For example: Presenting problems/chief complaints Medical History Family History Alerts Allergy/Intolerance and Adverse Reactions Medications Observations/Assessments (may include cognitive and fundtional assessments) Diagnostic Reports Care Plan.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "supportingInfo")]
    pub supporting_info: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_supportingInfo")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub supporting_info_ext: Vec<Option<FieldExtension>>,
    /** **Comments made about referral request**

 Comments made about the referral request by any of the participants.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
    /** **Key events in history of request**

 Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.

 This element does not point to the Provenance associated with the *current* version of the resource - as it would be created after this version existed.  The Provenance for the current version can be retrieved with a _revinclude. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relevantHistory")]
    pub relevant_history: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_relevantHistory")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub relevant_history_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ReferralRequestBuilder {
    #[doc = concat!("Finalize building ", "ReferralRequest", ".")]
    pub fn build(self) -> Result<ReferralRequest, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ReferralRequestInner> for ReferralRequest {
    fn from(inner: ReferralRequestInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ReferralRequest {
    type Target = ReferralRequestInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ReferralRequest {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ReferralRequest {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ReferralRequestBuilder {
        ReferralRequestBuilder::default()
    }
}
impl ReferralRequest {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ReferralRequest
    }
}
/// Choice of types for the occurrence[x] field in ReferralRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ReferralRequestOccurrence {
    /// Variant accepting the DateTime type.
    #[serde(rename = "occurrenceDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "occurrencePeriod")]
    Period(Period),
}
/// Extension value for ReferralRequestOccurrence.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ReferralRequestOccurrenceExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_occurrenceDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_occurrencePeriod")]
    Period(FieldExtension),
}
/// Sub-fields of the requester field in ReferralRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ReferralRequestRequesterBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ReferralRequestRequester {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Individual making the request**

 The device, practitioner, etc. who initiated the request.

 */
    #[serde(rename = "agent")]
    pub agent: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_agent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub agent_ext: Option<FieldExtension>,
    /** **Organization agent is acting for**

 The organization the device or practitioner was acting on behalf of.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "onBehalfOf")]
    pub on_behalf_of: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_onBehalfOf")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub on_behalf_of_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ReferralRequestRequester {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ReferralRequestRequesterBuilder {
        ReferralRequestRequesterBuilder::default()
    }
}
/** Base StructureDefinition for RelatedPerson Resource

 **[RelatedPerson](http://hl7.org/fhir/StructureDefinition/RelatedPerson) v3.0.2**

 An person that is related to a patient, but who is not a direct target of care

 Information about a person that is involved in the care for a patient, but who is not the target of healthcare, nor has a formal responsibility in the care process.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct RelatedPerson(pub Box<RelatedPersonInner>);
/** Base StructureDefinition for RelatedPerson Resource

 **[RelatedPerson](http://hl7.org/fhir/StructureDefinition/RelatedPerson) v3.0.2**

 An person that is related to a patient, but who is not a direct target of care

 Information about a person that is involved in the care for a patient, but who is not the target of healthcare, nor has a formal responsibility in the care process.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "RelatedPersonBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct RelatedPersonInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "RelatedPerson::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::RelatedPerson", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **A human identifier for this person**

 Identifier for a person within a particular scope.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Whether this related person's record is in active use**

 Whether this related person record is in active use.

 This element is labeled as a modifier because it may be used to mark that the resource was created in error. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "active")]
    pub active: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_active")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub active_ext: Option<FieldExtension>,
    /** **The patient this person is related to**

 The patient this person is related to.

 */
    #[serde(rename = "patient")]
    pub patient: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_ext: Option<FieldExtension>,
    /** **[PatientRelationshipType](http://hl7.org/fhir/ValueSet/relatedperson-relationshiptype); The nature of the relationship**

 The nature of the relationship between a patient and the related person.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relationship")]
    pub relationship: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_relationship")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub relationship_ext: Option<FieldExtension>,
    /** **A name associated with the person**

 A name associated with the person.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Vec<Option<HumanName>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub name_ext: Vec<Option<FieldExtension>>,
    /** **A contact detail for the person**

 A contact detail for the person, e.g. a telephone number or an email address.

 Person may have multiple ways to be contacted with different uses or applicable periods.  May need to have options for contacting the person urgently, and also to help with identification. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "telecom")]
    pub telecom: Vec<Option<ContactPoint>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_telecom")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub telecom_ext: Vec<Option<FieldExtension>>,
    /** **[AdministrativeGender](http://hl7.org/fhir/ValueSet/administrative-gender); male | female | other | unknown**

 Administrative Gender - the gender that the person is considered to have for administration and record keeping purposes.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "gender")]
    pub gender: Option<codes::AdministrativeGender>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_gender")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub gender_ext: Option<FieldExtension>,
    /** **The date on which the related person was born**

 The date on which the related person was born.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "birthDate")]
    pub birth_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_birthDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub birth_date_ext: Option<FieldExtension>,
    /** **Address where the related person can be contacted or visited**

 Address where the related person can be contacted or visited.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "address")]
    pub address: Vec<Option<Address>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_address")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub address_ext: Vec<Option<FieldExtension>>,
    /** **Image of the person**

 Image of the person.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "photo")]
    pub photo: Vec<Option<Attachment>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_photo")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub photo_ext: Vec<Option<FieldExtension>>,
    /** **Period of time that this relationship is considered valid**

 The period of time that this relationship is considered to be valid. If there are no dates defined, then the interval is unknown.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl RelatedPersonBuilder {
    #[doc = concat!("Finalize building ", "RelatedPerson", ".")]
    pub fn build(self) -> Result<RelatedPerson, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<RelatedPersonInner> for RelatedPerson {
    fn from(inner: RelatedPersonInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for RelatedPerson {
    type Target = RelatedPersonInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for RelatedPerson {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl RelatedPerson {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> RelatedPersonBuilder {
        RelatedPersonBuilder::default()
    }
}
impl RelatedPerson {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::RelatedPerson
    }
}
/** Base StructureDefinition for RequestGroup Resource

 **[RequestGroup](http://hl7.org/fhir/StructureDefinition/RequestGroup) v3.0.2**

 A group of related requests

 A group of related requests that can be used to capture intended activities that have inter-dependencies such as "give this medication after that one".

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct RequestGroup(pub Box<RequestGroupInner>);
/** Base StructureDefinition for RequestGroup Resource

 **[RequestGroup](http://hl7.org/fhir/StructureDefinition/RequestGroup) v3.0.2**

 A group of related requests

 A group of related requests that can be used to capture intended activities that have inter-dependencies such as "give this medication after that one".

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "RequestGroupBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct RequestGroupInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "RequestGroup::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::RequestGroup", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business identifier**

 Allows a service to provide a unique, business identifier for the request.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Instantiates protocol or definition**

 A protocol, guideline, orderset or other definition that is adhered to in whole or in part by this request.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "definition")]
    pub definition: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_definition")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub definition_ext: Vec<Option<FieldExtension>>,
    /** **Fulfills plan, proposal, or order**

 A plan, proposal or order that is fulfilled in whole or in part by this request.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basedOn")]
    pub based_on: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_basedOn")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub based_on_ext: Vec<Option<FieldExtension>>,
    /** **Request(s) replaced by this request**

 Completed or terminated request(s) whose function is taken by this new request.

 The replacement could be because the initial request was immediately rejected (due to an issue) or because the previous request was completed, but the need for the action described by the request remains ongoing. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "replaces")]
    pub replaces: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_replaces")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub replaces_ext: Vec<Option<FieldExtension>>,
    /** **Composite request this is part of**

 A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition, prescription or similar form.

 Requests are linked either by a "basedOn" relationship (i.e. one request is fulfilling another) or by having a common requisition.  Requests that are part of the same requisition are generally treated independently from the perspective of changing their state or maintaining them after initial creation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "groupIdentifier")]
    pub group_identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_groupIdentifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub group_identifier_ext: Option<FieldExtension>,
    /** **[RequestStatus](http://hl7.org/fhir/ValueSet/request-status); draft | active | suspended | cancelled | completed | entered-in-error | unknown**

 The current state of the request. For request groups, the status reflects the status of all the requests in the group.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::RequestStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[RequestIntent](http://hl7.org/fhir/ValueSet/request-intent); proposal | plan | order**

 Indicates the level of authority/intentionality associated with the request and where the request fits into the workflow chain.

 This element is labeled as a modifier because the intent alters when and how the resource is actually applicable. */
    #[serde(rename = "intent")]
    pub intent: codes::RequestIntent,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_intent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub intent_ext: Option<FieldExtension>,
    /** **[RequestPriority](http://hl7.org/fhir/ValueSet/request-priority); routine | urgent | asap | stat**

 Indicates how quickly the request should be addressed with respect to other requests.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "priority")]
    pub priority: Option<codes::RequestPriority>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_priority")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub priority_ext: Option<FieldExtension>,
    /** **Who the request group is about**

 The subject for which the request group was created.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Encounter or Episode for the request group**

 Describes the context of the request group, if any.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **When the request group was authored**

 Indicates when the request group was created.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authoredOn")]
    pub authored_on: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_authoredOn")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub authored_on_ext: Option<FieldExtension>,
    /** **Device or practitioner that authored the request group**

 Provides a reference to the author of the request group.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "author")]
    pub author: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_author")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub author_ext: Option<FieldExtension>,
    /** **Reason for the request group**

 Indicates the reason the request group was created. This is typically provided as a parameter to the evaluation and echoed by the service, although for some use cases, such as subscription- or event-based scenarios, it may provide an indication of the cause for the response.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub reason: Option<RequestGroupReason>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reason_ext: Option<RequestGroupReasonExtension>,
    /** **Additional notes about the response**

 Provides a mechanism to communicate additional information about the response.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
    /** **Proposed actions, if any**

 The actions, if any, produced by the evaluation of the artifact.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "action")]
    pub action: Vec<Option<RequestGroupAction>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_action")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub action_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl RequestGroupBuilder {
    #[doc = concat!("Finalize building ", "RequestGroup", ".")]
    pub fn build(self) -> Result<RequestGroup, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<RequestGroupInner> for RequestGroup {
    fn from(inner: RequestGroupInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for RequestGroup {
    type Target = RequestGroupInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for RequestGroup {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl RequestGroup {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> RequestGroupBuilder {
        RequestGroupBuilder::default()
    }
}
impl RequestGroup {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::RequestGroup
    }
}
/// Choice of types for the reason[x] field in RequestGroup
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RequestGroupReason {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "reasonCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "reasonReference")]
    Reference(Reference),
}
/// Extension value for RequestGroupReason.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RequestGroupReasonExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_reasonCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_reasonReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the action field in RequestGroup
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "RequestGroupActionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct RequestGroupAction {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **User-visible label for the action (e.g. 1. or A.)**

 A user-visible label for the action.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "label")]
    pub label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_label")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub label_ext: Option<FieldExtension>,
    /** **User-visible title**

 The title of the action displayed to a user.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **Short description of the action**

 A short description of the action used to provide a summary to display to the user.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Static text equivalent of the action, used if the dynamic aspects cannot be interpreted by the receiving system**

 A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that may not be capable of interpreting it dynamically.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "textEquivalent")]
    pub text_equivalent: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_textEquivalent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub text_equivalent_ext: Option<FieldExtension>,
    /** **Code representing the meaning of the action or sub-actions**

 A code that provides meaning for the action or action group. For example, a section may have a LOINC code for a the section of a documentation template.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub code_ext: Vec<Option<FieldExtension>>,
    /** **Supporting documentation for the intended performer of the action**

 Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "documentation")]
    pub documentation: Vec<Option<RelatedArtifact>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_documentation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub documentation_ext: Vec<Option<FieldExtension>>,
    /** **Whether or not the action is applicable**

 An expression that describes applicability criteria, or start/stop conditions for the action.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "condition")]
    pub condition: Vec<Option<RequestGroupActionCondition>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_condition")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub condition_ext: Vec<Option<FieldExtension>>,
    /** **Relationship to another action**

 A relationship to another action such as "before" or "30-60 minutes after start of".

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relatedAction")]
    pub related_action: Vec<Option<RequestGroupActionRelatedAction>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_relatedAction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub related_action_ext: Vec<Option<FieldExtension>>,
    /** **When the action should take place**

 An optional value describing when the action should be performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub timing: Option<RequestGroupActionTiming>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub timing_ext: Option<RequestGroupActionTimingExtension>,
    /** **Who should perform the action**

 The participant that should perform or be responsible for this action.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "participant")]
    pub participant: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_participant")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub participant_ext: Vec<Option<FieldExtension>>,
    /** **[ActionType](http://hl7.org/fhir/ValueSet/action-type); create | update | remove | fire-event**

 The type of action to perform (create, update, remove).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[ActionGroupingBehavior](http://hl7.org/fhir/ValueSet/action-grouping-behavior); visual-group | logical-group | sentence-group**

 Defines the grouping behavior for the action and its children.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "groupingBehavior")]
    pub grouping_behavior: Option<codes::ActionGroupingBehavior>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_groupingBehavior")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub grouping_behavior_ext: Option<FieldExtension>,
    /** **[ActionSelectionBehavior](http://hl7.org/fhir/ValueSet/action-selection-behavior); any | all | all-or-none | exactly-one | at-most-one | one-or-more**

 Defines the selection behavior for the action and its children.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "selectionBehavior")]
    pub selection_behavior: Option<codes::ActionSelectionBehavior>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_selectionBehavior")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub selection_behavior_ext: Option<FieldExtension>,
    /** **[ActionRequiredBehavior](http://hl7.org/fhir/ValueSet/action-required-behavior); must | could | must-unless-documented**

 Defines the requiredness behavior for the action.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requiredBehavior")]
    pub required_behavior: Option<codes::ActionRequiredBehavior>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requiredBehavior")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub required_behavior_ext: Option<FieldExtension>,
    /** **[ActionPrecheckBehavior](http://hl7.org/fhir/ValueSet/action-precheck-behavior); yes | no**

 Defines whether the action should usually be preselected.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "precheckBehavior")]
    pub precheck_behavior: Option<codes::ActionPrecheckBehavior>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_precheckBehavior")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub precheck_behavior_ext: Option<FieldExtension>,
    /** **[ActionCardinalityBehavior](http://hl7.org/fhir/ValueSet/action-cardinality-behavior); single | multiple**

 Defines whether the action can be selected multiple times.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "cardinalityBehavior")]
    pub cardinality_behavior: Option<codes::ActionCardinalityBehavior>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_cardinalityBehavior")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub cardinality_behavior_ext: Option<FieldExtension>,
    /** **The target of the action**

 The resource that is the target of the action (e.g. CommunicationRequest).

 The target resource SHALL be a [Request](request.html) resource with a Request.intent set to "option". */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "resource")]
    pub resource: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_resource")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub resource_ext: Option<FieldExtension>,
    /** **Sub action**

 Sub actions.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "action")]
    pub action: Vec<Option<RequestGroupAction>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_action")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub action_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl RequestGroupAction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> RequestGroupActionBuilder {
        RequestGroupActionBuilder::default()
    }
}
/// Sub-fields of the condition field in RequestGroupAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "RequestGroupActionConditionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct RequestGroupActionCondition {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[ActionConditionKind](http://hl7.org/fhir/ValueSet/action-condition-kind); applicability | start | stop**

 The kind of condition.

 Applicability criteria are used to determine immediate applicability when a plan definition is applied to a given context. Start and stop criteria are carried through application and used to describe when enter/exit criteria for an action. */
    #[serde(rename = "kind")]
    pub kind: codes::ActionConditionKind,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_kind")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub kind_ext: Option<FieldExtension>,
    /** **Natural language description of the condition**

 A brief, natural language description of the condition that effectively communicates the intended semantics.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Language of the expression**

 The media type of the language for the expression.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_language")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub language_ext: Option<FieldExtension>,
    /** **Boolean-valued expression**

 An expression that returns true or false, indicating whether or not the condition is satisfied.

 The expression may be inlined, or may be a reference to a named expression within a logic library referenced by the library element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "expression")]
    pub expression: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_expression")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub expression_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl RequestGroupActionCondition {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> RequestGroupActionConditionBuilder {
        RequestGroupActionConditionBuilder::default()
    }
}
/// Sub-fields of the relatedAction field in RequestGroupAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "RequestGroupActionRelatedActionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct RequestGroupActionRelatedAction {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **What action this is related to**

 The element id of the action this is related to.

 */
    #[serde(rename = "actionId")]
    pub action_id: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_actionId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub action_id_ext: Option<FieldExtension>,
    /** **[ActionRelationshipType](http://hl7.org/fhir/ValueSet/action-relationship-type); before-start | before | before-end | concurrent-with-start | concurrent | concurrent-with-end | after-start | after | after-end**

 The relationship of this action to the related action.

 */
    #[serde(rename = "relationship")]
    pub relationship: codes::ActionRelationshipType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_relationship")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub relationship_ext: Option<FieldExtension>,
    /** **Time offset for the relationship**

 A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub offset: Option<RequestGroupActionRelatedActionOffset>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub offset_ext: Option<RequestGroupActionRelatedActionOffsetExtension>,
}
#[cfg(feature = "builders")]
impl RequestGroupActionRelatedAction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> RequestGroupActionRelatedActionBuilder {
        RequestGroupActionRelatedActionBuilder::default()
    }
}
/// Choice of types for the offset[x] field in RequestGroupActionRelatedAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RequestGroupActionRelatedActionOffset {
    /// Variant accepting the Duration type.
    #[serde(rename = "offsetDuration")]
    Duration(Duration),
    /// Variant accepting the Range type.
    #[serde(rename = "offsetRange")]
    Range(Range),
}
/// Extension value for RequestGroupActionRelatedActionOffset.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RequestGroupActionRelatedActionOffsetExtension {
    /// Variant accepting the Duration extension.
    #[serde(rename = "_offsetDuration")]
    Duration(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_offsetRange")]
    Range(FieldExtension),
}
/// Choice of types for the timing[x] field in RequestGroupAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RequestGroupActionTiming {
    /// Variant accepting the DateTime type.
    #[serde(rename = "timingDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "timingPeriod")]
    Period(Period),
    /// Variant accepting the Duration type.
    #[serde(rename = "timingDuration")]
    Duration(Duration),
    /// Variant accepting the Range type.
    #[serde(rename = "timingRange")]
    Range(Range),
    /// Variant accepting the Timing type.
    #[serde(rename = "timingTiming")]
    Timing(Timing),
}
/// Extension value for RequestGroupActionTiming.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RequestGroupActionTimingExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_timingDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_timingPeriod")]
    Period(FieldExtension),
    /// Variant accepting the Duration extension.
    #[serde(rename = "_timingDuration")]
    Duration(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_timingRange")]
    Range(FieldExtension),
    /// Variant accepting the Timing extension.
    #[serde(rename = "_timingTiming")]
    Timing(FieldExtension),
}
/** Base StructureDefinition for ResearchStudy Resource

 **[ResearchStudy](http://hl7.org/fhir/StructureDefinition/ResearchStudy) v3.0.2**

 Investigation to increase healthcare-related patient-independent knowledge

 A process where a researcher or organization plans and then executes a series of steps intended to increase the field of healthcare-related knowledge.  This includes studies of safety, efficacy, comparative effectiveness and other information about medications, devices, therapies and other interventional and investigative techniques.  A ResearchStudy involves the gathering of information about human or animal subjects.

 Need to make sure we encompass public health studies. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ResearchStudy(pub Box<ResearchStudyInner>);
/** Base StructureDefinition for ResearchStudy Resource

 **[ResearchStudy](http://hl7.org/fhir/StructureDefinition/ResearchStudy) v3.0.2**

 Investigation to increase healthcare-related patient-independent knowledge

 A process where a researcher or organization plans and then executes a series of steps intended to increase the field of healthcare-related knowledge.  This includes studies of safety, efficacy, comparative effectiveness and other information about medications, devices, therapies and other interventional and investigative techniques.  A ResearchStudy involves the gathering of information about human or animal subjects.

 Need to make sure we encompass public health studies. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ResearchStudyBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ResearchStudyInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ResearchStudy::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ResearchStudy", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business Identifier for study**

 Identifiers assigned to this research study by the sponsor or other systems.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Name for this study**

 A short, descriptive user-friendly label for the study.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **Steps followed in executing study**

 The set of steps expected to be performed as part of the execution of the study.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "protocol")]
    pub protocol: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_protocol")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub protocol_ext: Vec<Option<FieldExtension>>,
    /** **Part of larger study**

 A larger research study of which this particular study is a component or step.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "partOf")]
    pub part_of: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_partOf")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub part_of_ext: Vec<Option<FieldExtension>>,
    /** **[ResearchStudyStatus](http://hl7.org/fhir/ValueSet/research-study-status); draft | in-progress | suspended | stopped | completed | entered-in-error**

 The current state of the study.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::ResearchStudyStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[ResearchStudyCategory](); Classifications for the study**

 Codes categorizing the type of study such as investigational vs. observational, type of blinding, type of randomization, safety vs. efficacy, etc.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub category_ext: Vec<Option<FieldExtension>>,
    /** **[ResearchStudyFocus](); Drugs, devices, conditions, etc. under study**

 The condition(s), medication(s), food(s), therapy(ies), device(s) or other concerns or interventions that the study is seeking to gain more information about.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "focus")]
    pub focus: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_focus")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub focus_ext: Vec<Option<FieldExtension>>,
    /** **Contact details for the study**

 Contact details to assist a user in learning more about or engaging with the study.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **References and dependencies**

 Citations, references and other related documents.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relatedArtifact")]
    pub related_artifact: Vec<Option<RelatedArtifact>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_relatedArtifact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub related_artifact_ext: Vec<Option<FieldExtension>>,
    /** **[ResearchStudyKeyword](); Used to search for the study**

 Key terms to aid in searching for or filtering the study.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "keyword")]
    pub keyword: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_keyword")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub keyword_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Geographic region(s) for study**

 Indicates a country, state or other region where the study is taking place.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **What this is study doing**

 A full description of how the study is being conducted.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Inclusion & exclusion criteria**

 Reference to a Group that defines the criteria for and quantity of subjects participating in the study.  E.g. " 200 female Europeans between the ages of 20 and 45 with early onset diabetes".

 The Group referenced should not generally enumerate specific subjects.  Subjects will be linked to the study using the ResearchSubject resource. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "enrollment")]
    pub enrollment: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_enrollment")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub enrollment_ext: Vec<Option<FieldExtension>>,
    /** **When the study began and ended**

 Identifies the start date and the expected (or actual, depending on status) end date for the study.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
    /** **Organization responsible for the study**

 The organization responsible for the execution of the study.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sponsor")]
    pub sponsor: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sponsor")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sponsor_ext: Option<FieldExtension>,
    /** **The individual responsible for the study**

 Indicates the individual who has primary oversite of the execution of the study.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "principalInvestigator")]
    pub principal_investigator: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_principalInvestigator")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub principal_investigator_ext: Option<FieldExtension>,
    /** **Location involved in study execution**

 Clinic, hospital or other healthcare location that is participating in the study.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "site")]
    pub site: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_site")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub site_ext: Vec<Option<FieldExtension>>,
    /** **Reason for terminating study early**

 A description and/or code explaining the premature termination of the study.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reasonStopped")]
    pub reason_stopped: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reasonStopped")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reason_stopped_ext: Option<FieldExtension>,
    /** **Comments made about the event**

 Comments made about the event by the performer, subject or other participants.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
    /** **Defined path through the study for a subject**

 Describes an expected sequence of events for one of the participants of a study.  E.g. Exposure to drug A, wash-out, exposure to drug B, wash-out, follow-up.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "arm")]
    pub arm: Vec<Option<ResearchStudyArm>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_arm")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub arm_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ResearchStudyBuilder {
    #[doc = concat!("Finalize building ", "ResearchStudy", ".")]
    pub fn build(self) -> Result<ResearchStudy, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ResearchStudyInner> for ResearchStudy {
    fn from(inner: ResearchStudyInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ResearchStudy {
    type Target = ResearchStudyInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ResearchStudy {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ResearchStudy {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ResearchStudyBuilder {
        ResearchStudyBuilder::default()
    }
}
impl ResearchStudy {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ResearchStudy
    }
}
/// Sub-fields of the arm field in ResearchStudy
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ResearchStudyArmBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ResearchStudyArm {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Label for study arm**

 Unique, human-readable label for this arm of the study.

 */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Categorization of study arm**

 Categorization of study arm, e.g. experimental, active comparator, placebo comparater.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Short explanation of study path**

 A succinct description of the path through the study that would be followed by a subject adhering to this arm.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ResearchStudyArm {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ResearchStudyArmBuilder {
        ResearchStudyArmBuilder::default()
    }
}
/** Base StructureDefinition for ResearchSubject Resource

 **[ResearchSubject](http://hl7.org/fhir/StructureDefinition/ResearchSubject) v3.0.2**

 Investigation to increase healthcare-related patient-independent knowledge

 A process where a researcher or organization plans and then executes a series of steps intended to increase the field of healthcare-related knowledge.  This includes studies of safety, efficacy, comparative effectiveness and other information about medications, devices, therapies and other interventional and investigative techniques.  A ResearchStudy involves the gathering of information about human or animal subjects.

 Need to make sure we encompass public health studies. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ResearchSubject(pub Box<ResearchSubjectInner>);
/** Base StructureDefinition for ResearchSubject Resource

 **[ResearchSubject](http://hl7.org/fhir/StructureDefinition/ResearchSubject) v3.0.2**

 Investigation to increase healthcare-related patient-independent knowledge

 A process where a researcher or organization plans and then executes a series of steps intended to increase the field of healthcare-related knowledge.  This includes studies of safety, efficacy, comparative effectiveness and other information about medications, devices, therapies and other interventional and investigative techniques.  A ResearchStudy involves the gathering of information about human or animal subjects.

 Need to make sure we encompass public health studies. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ResearchSubjectBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ResearchSubjectInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ResearchSubject::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ResearchSubject", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business Identifier for research subject**

 Identifiers assigned to this research study by the sponsor or other systems.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **[ResearchSubjectStatus](http://hl7.org/fhir/ValueSet/research-subject-status); candidate | enrolled | active | suspended | withdrawn | completed**

 The current state of the subject.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::ResearchSubjectStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **Start and end of participation**

 The dates the subject began and ended their participation in the study.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
    /** **Study subject is part of**

 Reference to the study the subject is participating in.

 */
    #[serde(rename = "study")]
    pub study: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_study")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub study_ext: Option<FieldExtension>,
    /** **Who is part of study**

 The record of the person or animal who is involved in the study.

 */
    #[serde(rename = "individual")]
    pub individual: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_individual")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub individual_ext: Option<FieldExtension>,
    /** **What path should be followed**

 The name of the arm in the study the subject is expected to follow as part of this study.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "assignedArm")]
    pub assigned_arm: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_assignedArm")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub assigned_arm_ext: Option<FieldExtension>,
    /** **What path was followed**

 The name of the arm in the study the subject actually followed as part of this study.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "actualArm")]
    pub actual_arm: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_actualArm")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub actual_arm_ext: Option<FieldExtension>,
    /** **Agreement to participate in study**

 A record of the patient's informed agreement to participate in the study.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "consent")]
    pub consent: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_consent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub consent_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ResearchSubjectBuilder {
    #[doc = concat!("Finalize building ", "ResearchSubject", ".")]
    pub fn build(self) -> Result<ResearchSubject, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ResearchSubjectInner> for ResearchSubject {
    fn from(inner: ResearchSubjectInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ResearchSubject {
    type Target = ResearchSubjectInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ResearchSubject {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ResearchSubject {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ResearchSubjectBuilder {
        ResearchSubjectBuilder::default()
    }
}
impl ResearchSubject {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ResearchSubject
    }
}
/** Base StructureDefinition for RiskAssessment Resource

 **[RiskAssessment](http://hl7.org/fhir/StructureDefinition/RiskAssessment) v3.0.2**

 Potential outcomes for a subject with likelihood

 An assessment of the likely outcome(s) for a patient or other subject as well as the likelihood of each outcome.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct RiskAssessment(pub Box<RiskAssessmentInner>);
/** Base StructureDefinition for RiskAssessment Resource

 **[RiskAssessment](http://hl7.org/fhir/StructureDefinition/RiskAssessment) v3.0.2**

 Potential outcomes for a subject with likelihood

 An assessment of the likely outcome(s) for a patient or other subject as well as the likelihood of each outcome.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "RiskAssessmentBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct RiskAssessmentInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "RiskAssessment::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::RiskAssessment", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Unique identifier for the assessment**

 Business identifier assigned to the risk assessment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **Request fulfilled by this assessment**

 A reference to the request that is fulfilled by this risk assessment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basedOn")]
    pub based_on: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_basedOn")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub based_on_ext: Option<FieldExtension>,
    /** **Part of this occurrence**

 A reference to a resource that this risk assessment is part of, such as a Procedure.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parent")]
    pub parent: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_parent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub parent_ext: Option<FieldExtension>,
    /** **[RiskAssessmentStatus](http://hl7.org/fhir/ValueSet/observation-status); registered | preliminary | final | amended +**

 The status of the RiskAssessment, using the same statuses as an Observation.

 */
    #[serde(rename = "status")]
    pub status: codes::ObservationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[RiskAssessmentMethod](); Evaluation mechanism**

 The algorithm, process or mechanism used to evaluate the risk.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "method")]
    pub method: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_method")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub method_ext: Option<FieldExtension>,
    /** **Type of assessment**

 The type of the risk assessment performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Who/what does assessment apply to?**

 The patient or group the risk assessment applies to.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "subject")]
    pub subject: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **Where was assessment performed?**

 The encounter where the assessment was performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **When was assessment made?**

 The date (and possibly time) the risk assessment was performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub occurrence: Option<RiskAssessmentOccurrence>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub occurrence_ext: Option<RiskAssessmentOccurrenceExtension>,
    /** **Condition assessed**

 For assessments or prognosis specific to a particular condition, indicates the condition being assessed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "condition")]
    pub condition: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_condition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub condition_ext: Option<FieldExtension>,
    /** **Who did assessment?**

 The provider or software application that performed the assessment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_performer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub performer_ext: Option<FieldExtension>,
    /** **Why the assessment was necessary?**

 The reason the risk assessment was performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub reason: Option<RiskAssessmentReason>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reason_ext: Option<RiskAssessmentReasonExtension>,
    /** **Information used in assessment**

 Indicates the source data considered as part of the assessment (FamilyHistory, Observations, Procedures, Conditions, etc.).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basis")]
    pub basis: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_basis")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub basis_ext: Vec<Option<FieldExtension>>,
    /** **Outcome predicted**

 Describes the expected outcome for the subject.

 Multiple repetitions can be used to identify the same type of outcome in different timeframes as well as different types of outcomes. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "prediction")]
    pub prediction: Vec<Option<RiskAssessmentPrediction>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_prediction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub prediction_ext: Vec<Option<FieldExtension>>,
    /** **How to reduce risk**

 A description of the steps that might be taken to reduce the identified risk(s).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "mitigation")]
    pub mitigation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_mitigation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub mitigation_ext: Option<FieldExtension>,
    /** **Comments on the risk assessment**

 Additional comments about the risk assessment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "comment")]
    pub comment: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_comment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub comment_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl RiskAssessmentBuilder {
    #[doc = concat!("Finalize building ", "RiskAssessment", ".")]
    pub fn build(self) -> Result<RiskAssessment, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<RiskAssessmentInner> for RiskAssessment {
    fn from(inner: RiskAssessmentInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for RiskAssessment {
    type Target = RiskAssessmentInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for RiskAssessment {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl RiskAssessment {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> RiskAssessmentBuilder {
        RiskAssessmentBuilder::default()
    }
}
impl RiskAssessment {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::RiskAssessment
    }
}
/// Choice of types for the occurrence[x] field in RiskAssessment
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RiskAssessmentOccurrence {
    /// Variant accepting the DateTime type.
    #[serde(rename = "occurrenceDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "occurrencePeriod")]
    Period(Period),
}
/// Extension value for RiskAssessmentOccurrence.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RiskAssessmentOccurrenceExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_occurrenceDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_occurrencePeriod")]
    Period(FieldExtension),
}
/// Choice of types for the reason[x] field in RiskAssessment
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RiskAssessmentReason {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "reasonCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "reasonReference")]
    Reference(Reference),
}
/// Extension value for RiskAssessmentReason.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RiskAssessmentReasonExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_reasonCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_reasonReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the prediction field in RiskAssessment
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "RiskAssessmentPredictionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct RiskAssessmentPrediction {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[RiskAssessmentOutcome](); Possible outcome for the subject**

 One of the potential outcomes for the patient (e.g. remission, death,  a particular condition).

 */
    #[serde(rename = "outcome")]
    pub outcome: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_outcome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub outcome_ext: Option<FieldExtension>,
    /** **Likelihood of specified outcome**

 How likely is the outcome (in the specified timeframe).

 If range is used, it represents the lower and upper bounds of certainty; e.g. 40-60%  Decimal values are expressed as percentages as well (max = 100). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub probability: Option<RiskAssessmentPredictionProbability>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub probability_ext: Option<RiskAssessmentPredictionProbabilityExtension>,
    /** **[RiskAssessmentProbability](http://hl7.org/fhir/ValueSet/risk-probability); Likelihood of specified outcome as a qualitative value**

 How likely is the outcome (in the specified timeframe), expressed as a qualitative value (e.g. low, medium, high).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "qualitativeRisk")]
    pub qualitative_risk: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_qualitativeRisk")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub qualitative_risk_ext: Option<FieldExtension>,
    /** **Relative likelihood**

 Indicates the risk for this particular subject (with their specific characteristics) divided by the risk of the population in general.  (Numbers greater than 1 = higher risk than the population, numbers less than 1 = lower risk.).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relativeRisk")]
    pub relative_risk: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_relativeRisk")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub relative_risk_ext: Option<FieldExtension>,
    /** **Timeframe or age range**

 Indicates the period of time or age range of the subject to which the specified probability applies.

 If not specified, the risk applies "over the subject's lifespan". */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub when: Option<RiskAssessmentPredictionWhen>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub when_ext: Option<RiskAssessmentPredictionWhenExtension>,
    /** **Explanation of prediction**

 Additional information explaining the basis for the prediction.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "rationale")]
    pub rationale: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_rationale")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub rationale_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl RiskAssessmentPrediction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> RiskAssessmentPredictionBuilder {
        RiskAssessmentPredictionBuilder::default()
    }
}
/// Choice of types for the probability[x] field in RiskAssessmentPrediction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RiskAssessmentPredictionProbability {
    /// Variant accepting the Decimal type.
    #[serde(rename = "probabilityDecimal")]
    Decimal(f64),
    /// Variant accepting the Range type.
    #[serde(rename = "probabilityRange")]
    Range(Range),
}
/// Extension value for RiskAssessmentPredictionProbability.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RiskAssessmentPredictionProbabilityExtension {
    /// Variant accepting the Decimal extension.
    #[serde(rename = "_probabilityDecimal")]
    Decimal(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_probabilityRange")]
    Range(FieldExtension),
}
/// Choice of types for the when[x] field in RiskAssessmentPrediction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RiskAssessmentPredictionWhen {
    /// Variant accepting the Period type.
    #[serde(rename = "whenPeriod")]
    Period(Period),
    /// Variant accepting the Range type.
    #[serde(rename = "whenRange")]
    Range(Range),
}
/// Extension value for RiskAssessmentPredictionWhen.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum RiskAssessmentPredictionWhenExtension {
    /// Variant accepting the Period extension.
    #[serde(rename = "_whenPeriod")]
    Period(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_whenRange")]
    Range(FieldExtension),
}
/** Base StructureDefinition for Schedule Resource

 **[Schedule](http://hl7.org/fhir/StructureDefinition/Schedule) v3.0.2**

 A container for slots of time that may be available for booking appointments

 A container for slots of time that may be available for booking appointments.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Schedule(pub Box<ScheduleInner>);
/** Base StructureDefinition for Schedule Resource

 **[Schedule](http://hl7.org/fhir/StructureDefinition/Schedule) v3.0.2**

 A container for slots of time that may be available for booking appointments

 A container for slots of time that may be available for booking appointments.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ScheduleBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ScheduleInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Schedule::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Schedule", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **External Ids for this item**

 External Ids for this item.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Whether this schedule is in active use**

 Whether this schedule record is in active use, or should not be used (such as was entered in error).

 This element is labeled as a modifier because it may be used to mark that the resource was created in error. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "active")]
    pub active: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_active")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub active_ext: Option<FieldExtension>,
    /** **[service-category](http://hl7.org/fhir/ValueSet/service-category); A broad categorisation of the service that is to be performed during this appointment**

 A broad categorisation of the service that is to be performed during this appointment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "serviceCategory")]
    pub service_category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_serviceCategory")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub service_category_ext: Option<FieldExtension>,
    /** **[service-type](http://hl7.org/fhir/ValueSet/service-type); The specific service that is to be performed during this appointment**

 The specific service that is to be performed during this appointment.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "serviceType")]
    pub service_type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_serviceType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub service_type_ext: Vec<Option<FieldExtension>>,
    /** **[specialty](http://hl7.org/fhir/ValueSet/c80-practice-codes); The specialty of a practitioner that would be required to perform the service requested in this appointment**

 The specialty of a practitioner that would be required to perform the service requested in this appointment.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "specialty")]
    pub specialty: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_specialty")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub specialty_ext: Vec<Option<FieldExtension>>,
    /** **The resource this Schedule resource is providing availability information for. These are expected to usually be one of HealthcareService, Location, Practitioner, PractitionerRole, Device, Patient or RelatedPerson**

 The resource this Schedule resource is providing availability information for. These are expected to usually be one of HealthcareService, Location, Practitioner, PractitionerRole, Device, Patient or RelatedPerson.

 The capacity to support multiple referenced resource types should be used in cases where the specific resources themselves cannot be scheduled without the other, and thus only make sense to the system exposing them as a group. Common examples of this are where the combination of a pracitioner and a room(location) are always required by a system. */
    #[serde(rename = "actor")]
    pub actor: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_actor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub actor_ext: Vec<Option<FieldExtension>>,
    /** **The period of time that the slots that are attached to this Schedule resource cover (even if none exist). These  cover the amount of time that an organization's planning horizon; the interval for which they are currently accepting appointments. This does not define a "template" for planning outside these dates**

 The period of time that the slots that are attached to this Schedule resource cover (even if none exist). These  cover the amount of time that an organization's planning horizon; the interval for which they are currently accepting appointments. This does not define a "template" for planning outside these dates.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "planningHorizon")]
    pub planning_horizon: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_planningHorizon")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub planning_horizon_ext: Option<FieldExtension>,
    /** **Comments on the availability to describe any extended information. Such as custom constraints on the slots that may be associated**

 Comments on the availability to describe any extended information. Such as custom constraints on the slots that may be associated.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "comment")]
    pub comment: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_comment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub comment_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ScheduleBuilder {
    #[doc = concat!("Finalize building ", "Schedule", ".")]
    pub fn build(self) -> Result<Schedule, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ScheduleInner> for Schedule {
    fn from(inner: ScheduleInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Schedule {
    type Target = ScheduleInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Schedule {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Schedule {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ScheduleBuilder {
        ScheduleBuilder::default()
    }
}
impl Schedule {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Schedule
    }
}
/** Base StructureDefinition for SearchParameter Resource

 **[SearchParameter](http://hl7.org/fhir/StructureDefinition/SearchParameter) v3.0.2**

 Search Parameter for a resource

 A search parameter that defines a named search item that can be used to search/filter on a resource.

 In FHIR, search is not performed directly on a resource (by XML or JSON path), but on a named parameter that maps into the resource content. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct SearchParameter(pub Box<SearchParameterInner>);
/** Base StructureDefinition for SearchParameter Resource

 **[SearchParameter](http://hl7.org/fhir/StructureDefinition/SearchParameter) v3.0.2**

 Search Parameter for a resource

 A search parameter that defines a named search item that can be used to search/filter on a resource.

 In FHIR, search is not performed directly on a resource (by XML or JSON path), but on a named parameter that maps into the resource content. */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SearchParameterBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct SearchParameterInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "SearchParameter::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::SearchParameter", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical URI to reference this search parameter (globally unique)**

 An absolute URI that is used to identify this search parameter when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this search parameter is (or will be) published. The URL SHOULD include the major version of the search parameter. For more information see [Technical and Business Versions](resource.html#versions).

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred.  Multiple instances may share the same url if they have a distinct version. */
    #[serde(rename = "url")]
    pub url: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Business version of the search parameter**

 The identifier that is used to identify this version of the search parameter when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the search parameter author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.

 There may be different search parameter instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a refrence to a particular business version of the search parameter with the format [url]|[version]. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Name for this search parameter (computer friendly)**

 A natural language name identifying the search parameter. This name should be usable as an identifier for the module by machine processing applications such as code generation.

 The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure that it is computable friendly. */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this search parameter. Enables tracking the life-cycle of the content.

 Allows filtering of search parameters that are appropriate for use vs. not.
This is labeled as "Is Modifier" because applications should not use a retired search parameter without due consideration. */
    #[serde(rename = "status")]
    pub status: codes::PublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **For testing purposes, not real usage**

 A boolean value to indicate that this search parameter is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of search parameter that are appropriate for use vs. not. This is labeled as "Is Modifier" because applications should not use an experimental search parameter in production. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "experimental")]
    pub experimental: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_experimental")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub experimental_ext: Option<FieldExtension>,
    /** **Date this was last changed**

 The date  (and optionally time) when the search parameter was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the search parameter changes.

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the search parameter. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Name of the publisher (organization or individual)**

 The name of the individual or organization that published the search parameter.

 Usually an organization, but may be an individual. The publisher (or steward) of the search parameter is the organization or individual primarily responsible for the maintenance and upkeep of the search parameter. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the search parameter. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisher")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_ext: Option<FieldExtension>,
    /** **Contact details for the publisher**

 Contact details to assist a user in finding and communicating with the publisher.

 May be a web site, an email address, a telephone number, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Context the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate search parameter instances.

 When multiple useContexts are specified, there is no expectation whether all or any of the contexts apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useContext")]
    pub use_context: Vec<Option<UsageContext>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_useContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_context_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Intended jurisdiction for search parameter (if applicable)**

 A legal or geographic region in which the search parameter is intended to be used.

 It may be possible for the search parameter to be used in jurisdictions other than those for which it was originally designed or intended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **Why this search parameter is defined**

 Explaination of why this search parameter is needed and why it has been designed as it has.

 This element does not describe the usage of the search parameter Instead  it provides traceability of ''why'' the resource is either needed or ''why'' it is defined as it is.  This may be used to point to source materials or specifications that drove the structure of this search parameter. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purpose")]
    pub purpose: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_purpose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub purpose_ext: Option<FieldExtension>,
    /** **Code used in URL**

 The code used in the URL or the parameter name in a parameters resource for this search parameter.

 For maximum compatibility, use only lowercase ASCII characters. */
    #[serde(rename = "code")]
    pub code: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **[ResourceType](http://hl7.org/fhir/ValueSet/resource-types); The resource type(s) this search parameter applies to**

 The base resource type(s) that this search parameter can be used against.

 A search parameter must always have at least one type. When search parameters have more than one resource, they can be used against any of the listed resource types, or in a cross-type search (see [Cross Resource Search](http.html#xres-search)). */
    #[serde(rename = "base")]
    pub base: Vec<Option<codes::ResourceType>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_base")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub base_ext: Vec<Option<FieldExtension>>,
    /** **[SearchParamType](http://hl7.org/fhir/ValueSet/search-param-type); number | date | string | token | reference | composite | quantity | uri**

 The type of value a search parameter refers to, and how the content is interpreted.

 */
    #[serde(rename = "type")]
    pub r#type: codes::SearchParamType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Original Definition for the search parameter**

 Where this search parameter is originally defined. If a derivedFrom is provided, then the details in the search parameter must be consistent with the definition from which it is defined. I.e. the parameter should have the same meaning, and (usually) the functionality should be a proper subset of the underlying search parameter.

 The intent of this is that a server can designate that it provides support for a search parameter defined in the specification itself (e.g.  [`value-quantity`](http://hl7.org/fhir/SearchParameter/Observation-value-quantity), but detail how it is supported by the server. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "derivedFrom")]
    pub derived_from: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_derivedFrom")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub derived_from_ext: Option<FieldExtension>,
    /** **Natural language description of the search parameter**

 A free text natural language description of the search parameter from a consumer's perspective. and how it used.

 This description can be used to capture details such as why the search parameter was built, comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the search parameter as conveyed in the 'text' field of the resource itself. This item SHOULD be populated unless the information is available from context (e.g. the language of the profile is presumed to be the predominant language in the place the profile was created). */
    #[serde(rename = "description")]
    pub description: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **FHIRPath expression that extracts the values**

 A FHIRPath expression that returns a set of elements for the search parameter.

 Note that the elements returned by the expression are sometimes complex elements where logic is required to determine quite how to handle them; e.g. CodeableConcepts may contain text and/or multiple codings, where the codings themselves contain a code and a system. For composite search parameters, the outcome of the expression must a collection of base elements from which the composites are derived. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "expression")]
    pub expression: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_expression")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub expression_ext: Option<FieldExtension>,
    /** **XPath that extracts the values**

 An XPath expression that returns a set of elements for the search parameter.

 Note that the elements returned by the XPath are sometimes complex elements where logic is required to determine quite how to handle them; e.g. CodeableConcepts may contain text and/or multiple codings, where the codings themselves contain a code and a system. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "xpath")]
    pub xpath: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_xpath")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub xpath_ext: Option<FieldExtension>,
    /** **[XPathUsageType](http://hl7.org/fhir/ValueSet/search-xpath-usage); normal | phonetic | nearby | distance | other**

 How the search parameter relates to the set of elements returned by evaluating the xpath query.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "xpathUsage")]
    pub xpath_usage: Option<codes::XPathUsageType>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_xpathUsage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub xpath_usage_ext: Option<FieldExtension>,
    /** **[ResourceType](http://hl7.org/fhir/ValueSet/resource-types); Types of resource (if a resource reference)**

 Types of resource (if a resource is referenced).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "target")]
    pub target: Vec<Option<codes::ResourceType>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_target")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub target_ext: Vec<Option<FieldExtension>>,
    /** **[SearchComparator](http://hl7.org/fhir/ValueSet/search-comparator); eq | ne | gt | lt | ge | le | sa | eb | ap**

 Comparators supported for the search parameter.

 If no comparators are listed, clients should not expect servers to support any comparators. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "comparator")]
    pub comparator: Vec<Option<codes::SearchComparator>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_comparator")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub comparator_ext: Vec<Option<FieldExtension>>,
    /** **[SearchModifierCode](http://hl7.org/fhir/ValueSet/search-modifier-code); missing | exact | contains | not | text | in | not-in | below | above | type**

 A modifier supported for the search parameter.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifier")]
    pub modifier: Vec<Option<codes::SearchModifierCode>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_modifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub modifier_ext: Vec<Option<FieldExtension>>,
    /** **Chained names supported**

 Contains the names of any search parameters which may be chained to the containing search parameter. Chained parameters may be added to search parameters of type reference, and specify that resources will only be returned if they contain a reference to a resource which matches the chained parameter value. Values for this field should be drawn from SearchParameter.code for a parameter on the target resource type.

 Systems are not required to list all the chain names they support, but if they don't list them, clients may not know to use them. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "chain")]
    pub chain: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_chain")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub chain_ext: Vec<Option<FieldExtension>>,
    /** **For Composite resources to define the parts**

 Used to define the parts of a composite search parameter.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "component")]
    pub component: Vec<Option<SearchParameterComponent>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_component")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub component_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SearchParameterBuilder {
    #[doc = concat!("Finalize building ", "SearchParameter", ".")]
    pub fn build(self) -> Result<SearchParameter, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<SearchParameterInner> for SearchParameter {
    fn from(inner: SearchParameterInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for SearchParameter {
    type Target = SearchParameterInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for SearchParameter {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl SearchParameter {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> SearchParameterBuilder {
        SearchParameterBuilder::default()
    }
}
impl SearchParameter {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::SearchParameter
    }
}
/// Sub-fields of the component field in SearchParameter
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SearchParameterComponentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SearchParameterComponent {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Defines how the part works**

 The definition of the search parameter that describes this part.

 */
    #[serde(rename = "definition")]
    pub definition: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_definition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub definition_ext: Option<FieldExtension>,
    /** **Subexpression relative to main expression**

 A sub-expression that defines how to extract values for this component from the output of the main SearchParameter.expression.

 This expression overrides the expression in the definition, and extracts the index values from the outcome of the composite expression. */
    #[serde(rename = "expression")]
    pub expression: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_expression")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub expression_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SearchParameterComponent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SearchParameterComponentBuilder {
        SearchParameterComponentBuilder::default()
    }
}
/** Base StructureDefinition for Sequence Resource

 **[Sequence](http://hl7.org/fhir/StructureDefinition/Sequence) v3.0.2**

 Information about a biological sequence

 Raw data describing a biological sequence.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Sequence(pub Box<SequenceInner>);
/** Base StructureDefinition for Sequence Resource

 **[Sequence](http://hl7.org/fhir/StructureDefinition/Sequence) v3.0.2**

 Information about a biological sequence

 Raw data describing a biological sequence.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SequenceBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct SequenceInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Sequence::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Sequence", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Unique ID for this particular sequence. This is a FHIR-defined id**

 A unique identifier for this particular sequence instance. This is a FHIR-defined id.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[sequenceType](http://hl7.org/fhir/ValueSet/sequence-type); aa | dna | rna**

 Amino Acid Sequence/ DNA Sequence / RNA Sequence.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Base number of coordinate system (0 for 0-based numbering or coordinates, inclusive start, exclusive end, 1 for 1-based numbering, inclusive start, inclusive end)**

 Whether the sequence is numbered starting at 0 (0-based numbering or coordinates, inclusive start, exclusive end) or starting at 1 (1-based numbering, inclusive start and inclusive end).

 */
    #[serde(rename = "coordinateSystem")]
    pub coordinate_system: i32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_coordinateSystem")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub coordinate_system_ext: Option<FieldExtension>,
    /** **Who and/or what this is about**

 The patient whose sequencing results are described by this resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patient")]
    pub patient: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_ext: Option<FieldExtension>,
    /** **Specimen used for sequencing**

 Specimen used for sequencing.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "specimen")]
    pub specimen: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_specimen")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub specimen_ext: Option<FieldExtension>,
    /** **The method for sequencing**

 The method for sequencing, for example, chip information.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "device")]
    pub device: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_device")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub device_ext: Option<FieldExtension>,
    /** **Who should be responsible for test result**

 The organization or lab that should be responsible for this result.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performer")]
    pub performer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_performer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub performer_ext: Option<FieldExtension>,
    /** **The number of copies of the seqeunce of interest.  (RNASeq)**

 The number of copies of the seqeunce of interest. (RNASeq).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_quantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<FieldExtension>,
    /** **A sequence used as reference**

 A sequence that is used as a reference to describe variants that are present in a sequence analyzed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "referenceSeq")]
    pub reference_seq: Option<SequenceReferenceSeq>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_referenceSeq")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reference_seq_ext: Option<FieldExtension>,
    /** **Variant in sequence**

 The definition of variant here originates from Sequence ontology ([variant_of](http://www.sequenceontology.org/browser/current_svn/term/variant_of)). This element can represent amino acid or nucleic sequence change(including insertion,deletion,SNP,etc.)  It can represent some complex mutation or segment variation with the assist of CIGAR string.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "variant")]
    pub variant: Vec<Option<SequenceVariant>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_variant")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub variant_ext: Vec<Option<FieldExtension>>,
    /** **Sequence that was observed**

 Sequence that was observed. It is the result marked by referenceSeq along with variant records on referenceSeq. This shall starts from referenceSeq.windowStart and end by referenceSeq.windowEnd.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "observedSeq")]
    pub observed_seq: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_observedSeq")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub observed_seq_ext: Option<FieldExtension>,
    /** **An set of value as quality of sequence**

 An experimental feature attribute that defines the quality of the feature in a quantitative way, such as a phred quality score ([SO:0001686](http://www.sequenceontology.org/browser/current_svn/term/SO:0001686)).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quality")]
    pub quality: Vec<Option<SequenceQuality>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_quality")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub quality_ext: Vec<Option<FieldExtension>>,
    /** **Average number of reads representing a given nucleotide in the reconstructed sequence**

 Coverage (read depth or depth) is the average number of reads representing a given nucleotide in the reconstructed sequence.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "readCoverage")]
    pub read_coverage: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_readCoverage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub read_coverage_ext: Option<FieldExtension>,
    /** **External repository which contains detailed report related with observedSeq in this resource**

 Configurations of the external repository. The repository shall store target's observedSeq or records related with target's observedSeq.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "repository")]
    pub repository: Vec<Option<SequenceRepository>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_repository")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub repository_ext: Vec<Option<FieldExtension>>,
    /** **Pointer to next atomic sequence**

 Pointer to next atomic sequence which at most contains one variant.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "pointer")]
    pub pointer: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_pointer")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub pointer_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SequenceBuilder {
    #[doc = concat!("Finalize building ", "Sequence", ".")]
    pub fn build(self) -> Result<Sequence, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<SequenceInner> for Sequence {
    fn from(inner: SequenceInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Sequence {
    type Target = SequenceInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Sequence {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Sequence {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> SequenceBuilder {
        SequenceBuilder::default()
    }
}
impl Sequence {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Sequence
    }
}
/// Sub-fields of the referenceSeq field in Sequence
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SequenceReferenceSeqBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SequenceReferenceSeq {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[chromosome-human](http://hl7.org/fhir/ValueSet/chromosome-human); Chromosome containing genetic finding**

 Structural unit composed of a nucleic acid molecule which controls its own replication through the interaction of specific proteins at one or more origins of replication ([SO:0000340](http://www.sequenceontology.org/browser/current_svn/term/SO:0000340)).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "chromosome")]
    pub chromosome: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_chromosome")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub chromosome_ext: Option<FieldExtension>,
    /** **The Genome Build used for reference, following GRCh build versions e.g. 'GRCh 37'**

 The Genome Build used for reference, following GRCh build versions e.g. 'GRCh 37'.  Version number must be included if a versioned release of a primary build was used.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "genomeBuild")]
    pub genome_build: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_genomeBuild")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub genome_build_ext: Option<FieldExtension>,
    /** **[sequenceReference](http://hl7.org/fhir/ValueSet/sequence-referenceSeq); Reference identifier**

 Reference identifier of reference sequence submitted to NCBI. It must match the type in the Sequence.type field. For example, the prefix, “NG_” identifies reference sequence for genes, “NM_” for messenger RNA transcripts, and “NP_” for amino acid sequences.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "referenceSeqId")]
    pub reference_seq_id: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_referenceSeqId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reference_seq_id_ext: Option<FieldExtension>,
    /** **A Pointer to another Sequence entity as reference sequence**

 A Pointer to another Sequence entity as reference sequence.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "referenceSeqPointer")]
    pub reference_seq_pointer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_referenceSeqPointer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reference_seq_pointer_ext: Option<FieldExtension>,
    /** **A string to represent reference sequence**

 A string like "ACGT".

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "referenceSeqString")]
    pub reference_seq_string: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_referenceSeqString")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reference_seq_string_ext: Option<FieldExtension>,
    /** **Directionality of DNA ( +1/-1)**

 Directionality of DNA sequence. Available values are "1" for the plus strand (5' to 3')/Watson/Sense/positive  and "-1" for the minus strand(3' to 5')/Crick/Antisense/negative.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "strand")]
    pub strand: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_strand")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub strand_ext: Option<FieldExtension>,
    /** **Start position of the window on the  reference sequence**

 Start position of the window on the reference sequence. If the coordinate system is either 0-based or 1-based, then start position is inclusive.

 */
    #[serde(rename = "windowStart")]
    pub window_start: i32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_windowStart")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub window_start_ext: Option<FieldExtension>,
    /** **End position of the window on the reference sequence**

 End position of the window on the reference sequence. If the coordinate system is 0-based then end is is exclusive and does not include the last position. If the coordinate system is 1-base, then end is inclusive and includes the last position.

 */
    #[serde(rename = "windowEnd")]
    pub window_end: i32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_windowEnd")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub window_end_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SequenceReferenceSeq {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SequenceReferenceSeqBuilder {
        SequenceReferenceSeqBuilder::default()
    }
}
/// Sub-fields of the variant field in Sequence
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SequenceVariantBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SequenceVariant {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Start position of the variant on the  reference sequence**

 Start position of the variant on the  reference sequence.If the coordinate system is either 0-based or 1-based, then start position is inclusive.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "start")]
    pub start: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_start")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub start_ext: Option<FieldExtension>,
    /** **End position of the variant on the reference sequence**

 End position of the variant on the reference sequence.If the coordinate system is 0-based then end is is exclusive and does not include the last position. If the coordinate system is 1-base, then end is inclusive and includes the last position.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "end")]
    pub end: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_end")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub end_ext: Option<FieldExtension>,
    /** **Allele that was observed**

 An allele is one of a set of coexisting sequence variants of a gene ([SO:0001023](http://www.sequenceontology.org/browser/current_svn/term/SO:0001023)).  Nucleotide(s)/amino acids from start position of sequence to stop position of sequence on the positive (+) strand of the observed  sequence. When the sequence  type is DNA, it should be the sequence on the positive (+) strand. This will lay in the range between variant.start and variant.end.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "observedAllele")]
    pub observed_allele: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_observedAllele")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub observed_allele_ext: Option<FieldExtension>,
    /** **Allele in the reference sequence**

 An allele is one of a set of coexisting sequence variants of a gene ([SO:0001023](http://www.sequenceontology.org/browser/current_svn/term/SO:0001023)). Nucleotide(s)/amino acids from start position of sequence to stop position of sequence on the positive (+) strand of the reference sequence. When the sequence  type is DNA, it should be the sequence on the positive (+) strand. This will lay in the range between variant.start and variant.end.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "referenceAllele")]
    pub reference_allele: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_referenceAllele")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reference_allele_ext: Option<FieldExtension>,
    /** **Extended CIGAR string for aligning the sequence with reference bases**

 Extended CIGAR string for aligning the sequence with reference bases. See detailed documentation [here](http://support.illumina.com/help/SequencingAnalysisWorkflow/Content/Vault/Informatics/Sequencing_Analysis/CASAVA/swSEQ_mCA_ExtendedCIGARFormat.htm).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "cigar")]
    pub cigar: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_cigar")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub cigar_ext: Option<FieldExtension>,
    /** **Pointer to observed variant information**

 A pointer to an Observation containing variant information.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "variantPointer")]
    pub variant_pointer: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_variantPointer")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub variant_pointer_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SequenceVariant {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SequenceVariantBuilder {
        SequenceVariantBuilder::default()
    }
}
/// Sub-fields of the quality field in Sequence
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SequenceQualityBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SequenceQuality {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[qualityType](http://hl7.org/fhir/ValueSet/quality-type); indel | snp | unknown**

 INDEL / SNP / Undefined variant.

 */
    #[serde(rename = "type")]
    pub r#type: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[qualityStandardSequence](http://hl7.org/fhir/ValueSet/sequence-quality-standardSequence); Standard sequence for comparison**

 Gold standard sequence used for comparing against.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "standardSequence")]
    pub standard_sequence: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_standardSequence")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub standard_sequence_ext: Option<FieldExtension>,
    /** **Start position of the sequence**

 Start position of the sequence. If the coordinate system is either 0-based or 1-based, then start position is inclusive.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "start")]
    pub start: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_start")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub start_ext: Option<FieldExtension>,
    /** **End position of the sequence**

 End position of the sequence.If the coordinate system is 0-based then end is is exclusive and does not include the last position. If the coordinate system is 1-base, then end is inclusive and includes the last position.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "end")]
    pub end: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_end")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub end_ext: Option<FieldExtension>,
    /** **Quality score for the comparison**

 The score of an experimentally derived feature such as a p-value ([SO:0001685](http://www.sequenceontology.org/browser/current_svn/term/SO:0001685)).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "score")]
    pub score: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_score")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub score_ext: Option<FieldExtension>,
    /** **[qualityMethod](http://hl7.org/fhir/ValueSet/sequence-quality-method); Method to get quality**

 Which method is used to get sequence quality.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "method")]
    pub method: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_method")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub method_ext: Option<FieldExtension>,
    /** **True positives from the perspective of the truth data**

 True positives, from the perspective of the truth data, i.e. the number of sites in the Truth Call Set for which there are paths through the Query Call Set that are consistent with all of the alleles at this site, and for which there is an accurate genotype call for the event.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "truthTP")]
    pub truth_tp: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_truthTP")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub truth_tp_ext: Option<FieldExtension>,
    /** **True positives from the perspective of the query data**

 True positives, from the perspective of the query data, i.e. the number of sites in the Query Call Set for which there are paths through the Truth Call Set that are consistent with all of the alleles at this site, and for which there is an accurate genotype call for the event.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "queryTP")]
    pub query_tp: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_queryTP")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub query_tp_ext: Option<FieldExtension>,
    /** **False negatives**

 False negatives, i.e. the number of sites in the Truth Call Set for which there is no path through the Query Call Set that is consistent with all of the alleles at this site, or sites for which there is an inaccurate genotype call for the event. Sites with correct variant but incorrect genotype are counted here.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "truthFN")]
    pub truth_fn: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_truthFN")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub truth_fn_ext: Option<FieldExtension>,
    /** **False positives**

 False positives, i.e. the number of sites in the Query Call Set for which there is no path through the Truth Call Set that is consistent with this site. Sites with correct variant but incorrect genotype are counted here.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "queryFP")]
    pub query_fp: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_queryFP")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub query_fp_ext: Option<FieldExtension>,
    /** **False positives where the non-REF alleles in the Truth and Query Call Sets match**

 The number of false positives where the non-REF alleles in the Truth and Query Call Sets match (i.e. cases where the truth is 1/1 and the query is 0/1 or similar).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "gtFP")]
    pub gt_fp: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_gtFP")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub gt_fp_ext: Option<FieldExtension>,
    /** **Precision of comparison**

 QUERY.TP / (QUERY.TP + QUERY.FP).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "precision")]
    pub precision: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_precision")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub precision_ext: Option<FieldExtension>,
    /** **Recall of comparison**

 TRUTH.TP / (TRUTH.TP + TRUTH.FN).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recall")]
    pub recall: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_recall")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub recall_ext: Option<FieldExtension>,
    /** **F-score**

 Harmonic mean of Recall and Precision, computed as: 2 * precision * recall / (precision + recall).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "fScore")]
    pub f_score: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_fScore")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub f_score_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SequenceQuality {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SequenceQualityBuilder {
        SequenceQualityBuilder::default()
    }
}
/// Sub-fields of the repository field in Sequence
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SequenceRepositoryBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SequenceRepository {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[repositoryType](http://hl7.org/fhir/ValueSet/repository-type); directlink | openapi | login | oauth | other**

 Click and see / RESTful API / Need login to see / RESTful API with authentication / Other ways to see resource.

 */
    #[serde(rename = "type")]
    pub r#type: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **URI of the repository**

 URI of an external repository which contains further details about the genetics data.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "url")]
    pub url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Repository's name**

 URI of an external repository which contains further details about the genetics data.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Id of the dataset that used to call for dataset in repository**

 Id of the variant in this external repository. The server will understand how to use this id to call for more info about datasets in external repository.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "datasetId")]
    pub dataset_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_datasetId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub dataset_id_ext: Option<FieldExtension>,
    /** **Id of the variantset that used to call for variantset in repository**

 Id of the variantset in this external repository. The server will understand how to use this id to call for more info about variantsets in external repository.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "variantsetId")]
    pub variantset_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_variantsetId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub variantset_id_ext: Option<FieldExtension>,
    /** **Id of the read**

 Id of the read in this external repository.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "readsetId")]
    pub readset_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_readsetId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub readset_id_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SequenceRepository {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SequenceRepositoryBuilder {
        SequenceRepositoryBuilder::default()
    }
}
/** Base StructureDefinition for ServiceDefinition Resource

 **[ServiceDefinition](http://hl7.org/fhir/StructureDefinition/ServiceDefinition) v3.0.2**

 A description of decision support service functionality

 The ServiceDefinition describes a unit of decision support functionality that is made available as a service, such as immunization modules or drug-drug interaction checking.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ServiceDefinition(pub Box<ServiceDefinitionInner>);
/** Base StructureDefinition for ServiceDefinition Resource

 **[ServiceDefinition](http://hl7.org/fhir/StructureDefinition/ServiceDefinition) v3.0.2**

 A description of decision support service functionality

 The ServiceDefinition describes a unit of decision support functionality that is made available as a service, such as immunization modules or drug-drug interaction checking.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ServiceDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ServiceDefinitionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ServiceDefinition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ServiceDefinition", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical URI to reference this service definition (globally unique)**

 An absolute URI that is used to identify this service definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this service definition is (or will be) published. The URL SHOULD include the major version of the service definition. For more information see [Technical and Business Versions](resource.html#versions).

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred.  Multiple instances may share the same url if they have a distinct version. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "url")]
    pub url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Additional identifier for the service definition**

 A formal identifier that is used to identify this service definition when it is represented in other formats, or referenced in a specification, model, design or an instance. This is used for CMS or NQF identifiers for a measure artifact. Note that at least one identifier is required for non-experimental active artifacts.

 Typically, this is used for identifiers that can go in an HL7 V3 II (instance identifier) data type, e.g., to identify this service definition outside of FHIR, where it is not possible to use the logical URI. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Business version of the service definition**

 The identifier that is used to identify this version of the service definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the service definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.

 There may be different service definition instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a refrence to a particular business version of the service definition with the format [url]|[version]. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Name for this service definition (computer friendly)**

 A natural language name identifying the service definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.

 The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure that it is computable friendly. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Name for this service definition (human friendly)**

 A short, descriptive, user-friendly title for the service definition.

 This name does not need to be machine-processing friendly and may contain punctuation, white-space, etc. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this service definition. Enables tracking the life-cycle of the content.

 Allows filtering of service definitions that are appropriate for use vs. not.
This is labeled as "Is Modifier" because applications should not use a retired service definition without due consideration. */
    #[serde(rename = "status")]
    pub status: codes::PublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **For testing purposes, not real usage**

 A boolean value to indicate that this service definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of service definition that are appropriate for use vs. not. This is labeled as "Is Modifier" because applications should not use an experimental service definition in production. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "experimental")]
    pub experimental: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_experimental")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub experimental_ext: Option<FieldExtension>,
    /** **Date this was last changed**

 The date  (and optionally time) when the service definition was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the service definition changes.

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the service definition. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Name of the publisher (organization or individual)**

 The name of the individual or organization that published the service definition.

 Usually an organization, but may be an individual. The publisher (or steward) of the service definition is the organization or individual primarily responsible for the maintenance and upkeep of the service definition. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the service definition. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisher")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_ext: Option<FieldExtension>,
    /** **Natural language description of the service definition**

 A free text natural language description of the service definition from a consumer's perspective.

 This description can be used to capture details such as why the service definition was built, comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the service definition as conveyed in the 'text' field of the resource itself. This item SHOULD be populated unless the information is available from context (e.g. the language of the profile is presumed to be the predominant language in the place the profile was created). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Why this service definition is defined**

 Explaination of why this service definition is needed and why it has been designed as it has.

 This element does not describe the usage of the service definition Instead  it provides traceability of ''why'' the resource is either needed or ''why'' it is defined as it is.  This may be used to point to source materials or specifications that drove the structure of this service definition. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purpose")]
    pub purpose: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_purpose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub purpose_ext: Option<FieldExtension>,
    /** **Describes the clinical usage of the module**

 A detailed description of how the module is used from a clinical perspective.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "usage")]
    pub usage: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_usage")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub usage_ext: Option<FieldExtension>,
    /** **When the service definition was approved by publisher**

 The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.

 The 'date' element may be more recent than the approval date because of minor changes / editorial corrections. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "approvalDate")]
    pub approval_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_approvalDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub approval_date_ext: Option<FieldExtension>,
    /** **When the service definition was last reviewed**

 The date on which the resource content was last reviewed. Review happens periodically after approval, but doesn't change the original approval date.

 If specified, this is usually after the approval date. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "lastReviewDate")]
    pub last_review_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_lastReviewDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub last_review_date_ext: Option<FieldExtension>,
    /** **When the service definition is expected to be used**

 The period during which the service definition content was or is planned to be in active use.

 The effective period for a service definition  determines when the content is applicable for usage and is independent of publication and review dates. For example, a measure intended to be used for the year 2016 might be published in 2015. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "effectivePeriod")]
    pub effective_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_effectivePeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub effective_period_ext: Option<FieldExtension>,
    /** **Context the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate service definition instances.

 When multiple useContexts are specified, there is no expectation whether all or any of the contexts apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useContext")]
    pub use_context: Vec<Option<UsageContext>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_useContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_context_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Intended jurisdiction for service definition (if applicable)**

 A legal or geographic region in which the service definition is intended to be used.

 It may be possible for the service definition to be used in jurisdictions other than those for which it was originally designed or intended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **[DefinitionTopic](http://hl7.org/fhir/ValueSet/definition-topic); E.g. Education, Treatment, Assessment, etc**

 Descriptive topics related to the module. Topics provide a high-level categorization of the module that can be useful for filtering and searching.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "topic")]
    pub topic: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_topic")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub topic_ext: Vec<Option<FieldExtension>>,
    /** **A content contributor**

 A contributor to the content of the module, including authors, editors, reviewers, and endorsers.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contributor")]
    pub contributor: Vec<Option<Contributor>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contributor")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contributor_ext: Vec<Option<FieldExtension>>,
    /** **Contact details for the publisher**

 Contact details to assist a user in finding and communicating with the publisher.

 May be a web site, an email address, a telephone number, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Use and/or publishing restrictions**

 A copyright statement relating to the service definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the service definition.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyright")]
    pub copyright: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyright")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_ext: Option<FieldExtension>,
    /** **Additional documentation, citations, etc**

 Related resources such as additional documentation, justification, or bibliographic references.

 Each related resource is either an attachment, or a reference to another resource, but not both. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relatedArtifact")]
    pub related_artifact: Vec<Option<RelatedArtifact>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_relatedArtifact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub related_artifact_ext: Vec<Option<FieldExtension>>,
    /** **"when" the module should be invoked**

 The trigger element defines when the rule should be invoked. This information is used by consumers of the rule to determine how to integrate the rule into a specific workflow.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "trigger")]
    pub trigger: Vec<Option<TriggerDefinition>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_trigger")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub trigger_ext: Vec<Option<FieldExtension>>,
    /** **What data is used by the module**

 Data requirements are a machine processable description of the data required by the module in order to perform a successful evaluation.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dataRequirement")]
    pub data_requirement: Vec<Option<DataRequirement>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_dataRequirement")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub data_requirement_ext: Vec<Option<FieldExtension>>,
    /** **Operation to invoke**

 A reference to the operation that is used to invoke this service.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "operationDefinition")]
    pub operation_definition: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_operationDefinition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub operation_definition_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ServiceDefinitionBuilder {
    #[doc = concat!("Finalize building ", "ServiceDefinition", ".")]
    pub fn build(self) -> Result<ServiceDefinition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ServiceDefinitionInner> for ServiceDefinition {
    fn from(inner: ServiceDefinitionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ServiceDefinition {
    type Target = ServiceDefinitionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ServiceDefinition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ServiceDefinition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ServiceDefinitionBuilder {
        ServiceDefinitionBuilder::default()
    }
}
impl ServiceDefinition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ServiceDefinition
    }
}
/** Base StructureDefinition for Slot Resource

 **[Slot](http://hl7.org/fhir/StructureDefinition/Slot) v3.0.2**

 A slot of time on a schedule that may be available for booking appointments

 A slot of time on a schedule that may be available for booking appointments.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Slot(pub Box<SlotInner>);
/** Base StructureDefinition for Slot Resource

 **[Slot](http://hl7.org/fhir/StructureDefinition/Slot) v3.0.2**

 A slot of time on a schedule that may be available for booking appointments

 A slot of time on a schedule that may be available for booking appointments.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SlotBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct SlotInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Slot::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Slot", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **External Ids for this item**

 External Ids for this item.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[service-category](http://hl7.org/fhir/ValueSet/service-category); A broad categorisation of the service that is to be performed during this appointment**

 A broad categorisation of the service that is to be performed during this appointment.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "serviceCategory")]
    pub service_category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_serviceCategory")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub service_category_ext: Option<FieldExtension>,
    /** **[service-type](http://hl7.org/fhir/ValueSet/service-type); The type of appointments that can be booked into this slot (ideally this would be an identifiable service - which is at a location, rather than the location itself). If provided then this overrides the value provided on the availability resource**

 The type of appointments that can be booked into this slot (ideally this would be an identifiable service - which is at a location, rather than the location itself). If provided then this overrides the value provided on the availability resource.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "serviceType")]
    pub service_type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_serviceType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub service_type_ext: Vec<Option<FieldExtension>>,
    /** **[specialty](http://hl7.org/fhir/ValueSet/c80-practice-codes); The specialty of a practitioner that would be required to perform the service requested in this appointment**

 The specialty of a practitioner that would be required to perform the service requested in this appointment.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "specialty")]
    pub specialty: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_specialty")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub specialty_ext: Vec<Option<FieldExtension>>,
    /** **[appointment-type](http://hl7.org/fhir/ValueSet/v2-0276); The style of appointment or patient that may be booked in the slot (not service type)**

 The style of appointment or patient that may be booked in the slot (not service type).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "appointmentType")]
    pub appointment_type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_appointmentType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub appointment_type_ext: Option<FieldExtension>,
    /** **The schedule resource that this slot defines an interval of status information**

 The schedule resource that this slot defines an interval of status information.

 */
    #[serde(rename = "schedule")]
    pub schedule: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_schedule")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub schedule_ext: Option<FieldExtension>,
    /** **[SlotStatus](http://hl7.org/fhir/ValueSet/slotstatus); busy | free | busy-unavailable | busy-tentative | entered-in-error**

 busy | free | busy-unavailable | busy-tentative | entered-in-error.

 */
    #[serde(rename = "status")]
    pub status: codes::SlotStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **Date/Time that the slot is to begin**

 Date/Time that the slot is to begin.

 */
    #[serde(rename = "start")]
    pub start: Instant,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_start")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub start_ext: Option<FieldExtension>,
    /** **Date/Time that the slot is to conclude**

 Date/Time that the slot is to conclude.

 */
    #[serde(rename = "end")]
    pub end: Instant,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_end")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub end_ext: Option<FieldExtension>,
    /** **This slot has already been overbooked, appointments are unlikely to be accepted for this time**

 This slot has already been overbooked, appointments are unlikely to be accepted for this time.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "overbooked")]
    pub overbooked: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_overbooked")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub overbooked_ext: Option<FieldExtension>,
    /** **Comments on the slot to describe any extended information. Such as custom constraints on the slot**

 Comments on the slot to describe any extended information. Such as custom constraints on the slot.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "comment")]
    pub comment: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_comment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub comment_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SlotBuilder {
    #[doc = concat!("Finalize building ", "Slot", ".")]
    pub fn build(self) -> Result<Slot, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<SlotInner> for Slot {
    fn from(inner: SlotInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Slot {
    type Target = SlotInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Slot {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Slot {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> SlotBuilder {
        SlotBuilder::default()
    }
}
impl Slot {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Slot
    }
}
/** Base StructureDefinition for Specimen Resource

 **[Specimen](http://hl7.org/fhir/StructureDefinition/Specimen) v3.0.2**

 Sample for analysis

 A sample to be used for analysis.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Specimen(pub Box<SpecimenInner>);
/** Base StructureDefinition for Specimen Resource

 **[Specimen](http://hl7.org/fhir/StructureDefinition/Specimen) v3.0.2**

 Sample for analysis

 A sample to be used for analysis.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SpecimenBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct SpecimenInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Specimen::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Specimen", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **External Identifier**

 Id for specimen.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Identifier assigned by the lab**

 The identifier assigned by the lab when accessioning specimen(s). This is not necessarily the same as the specimen identifier, depending on local lab procedures.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "accessionIdentifier")]
    pub accession_identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_accessionIdentifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub accession_identifier_ext: Option<FieldExtension>,
    /** **[SpecimenStatus](http://hl7.org/fhir/ValueSet/specimen-status); available | unavailable | unsatisfactory | entered-in-error**

 The availability of the specimen.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<codes::SpecimenStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[SpecimenType](http://hl7.org/fhir/ValueSet/v2-0487); Kind of material that forms the specimen**

 The kind of material that forms the specimen.

 The type can change the way that a specimen is handled, and drives what kind of analyses can properly be performed on the specimen. It is frequently used in diagnostic work flow decision making systems. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Where the specimen came from. This may be from the patient(s) or from the environment or a device**

 Where the specimen came from. This may be from the patient(s) or from the environment or a device.

 */
    #[serde(rename = "subject")]
    pub subject: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_subject")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub subject_ext: Option<FieldExtension>,
    /** **The time when specimen was received for processing**

 Time when specimen was received for processing or testing.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "receivedTime")]
    pub received_time: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_receivedTime")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub received_time_ext: Option<FieldExtension>,
    /** **Specimen from which this specimen originated**

 Reference to the parent (source) specimen which is used when the specimen was either derived from or a component of another specimen.

 The parent specimen could be the source from which the current specimen is derived by some processing step (e.g. an aliquot or isolate or extracted nucleic acids from clinical samples) or one of many specimens that were combined to create a pooled sample. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parent")]
    pub parent: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_parent")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub parent_ext: Vec<Option<FieldExtension>>,
    /** **Why the specimen was collected**

 Details concerning a test or procedure request that required a specimen to be collected.

 The request may be explicit or implied such with a ProcedureRequest that requires a blood draw. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "request")]
    pub request: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_request")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub request_ext: Vec<Option<FieldExtension>>,
    /** **Collection details**

 Details concerning the specimen collection.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "collection")]
    pub collection: Option<SpecimenCollection>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_collection")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub collection_ext: Option<FieldExtension>,
    /** **Processing and processing step details**

 Details concerning processing and processing steps for the specimen.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "processing")]
    pub processing: Vec<Option<SpecimenProcessing>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_processing")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub processing_ext: Vec<Option<FieldExtension>>,
    /** **Direct container of specimen (tube/slide, etc.)**

 The container holding the specimen.  The recursive nature of containers; i.e. blood in tube in tray in rack is not addressed here.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "container")]
    pub container: Vec<Option<SpecimenContainer>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_container")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub container_ext: Vec<Option<FieldExtension>>,
    /** **Comments**

 To communicate any details or issues about the specimen or during the specimen collection. (for example: broken vial, sent with patient, frozen).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SpecimenBuilder {
    #[doc = concat!("Finalize building ", "Specimen", ".")]
    pub fn build(self) -> Result<Specimen, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<SpecimenInner> for Specimen {
    fn from(inner: SpecimenInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Specimen {
    type Target = SpecimenInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Specimen {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Specimen {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> SpecimenBuilder {
        SpecimenBuilder::default()
    }
}
impl Specimen {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Specimen
    }
}
/// Sub-fields of the collection field in Specimen
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SpecimenCollectionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SpecimenCollection {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Who collected the specimen**

 Person who collected the specimen.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "collector")]
    pub collector: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_collector")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub collector_ext: Option<FieldExtension>,
    /** **Collection time**

 Time when specimen was collected from subject - the physiologically relevant time.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub collected: Option<SpecimenCollectionCollected>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub collected_ext: Option<SpecimenCollectionCollectedExtension>,
    /** **The quantity of specimen collected**

 The quantity of specimen collected; for instance the volume of a blood sample, or the physical measurement of an anatomic pathology sample.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_quantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<FieldExtension>,
    /** **[SpecimenCollectionMethod](http://hl7.org/fhir/ValueSet/specimen-collection-method); Technique used to perform collection**

 A coded value specifying the technique that is used to perform the procedure.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "method")]
    pub method: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_method")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub method_ext: Option<FieldExtension>,
    /** **[BodySite](http://hl7.org/fhir/ValueSet/body-site); Anatomical collection site**

 Anatomical location from which the specimen was collected (if subject is a patient). This is the target site.  This element is not used for environmental specimens.

 If the use case requires  BodySite to be handled as a separate resource instead of an inline coded element (e.g. to identify and track separately)  then use the standard extension [body-site-instance](extension-body-site-instance.html). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "bodySite")]
    pub body_site: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_bodySite")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub body_site_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SpecimenCollection {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SpecimenCollectionBuilder {
        SpecimenCollectionBuilder::default()
    }
}
/// Choice of types for the collected[x] field in SpecimenCollection
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SpecimenCollectionCollected {
    /// Variant accepting the DateTime type.
    #[serde(rename = "collectedDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "collectedPeriod")]
    Period(Period),
}
/// Extension value for SpecimenCollectionCollected.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SpecimenCollectionCollectedExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_collectedDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_collectedPeriod")]
    Period(FieldExtension),
}
/// Sub-fields of the processing field in Specimen
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SpecimenProcessingBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SpecimenProcessing {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Textual description of procedure**

 Textual description of procedure.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **[SpecimenProcessingProcedure](http://hl7.org/fhir/ValueSet/specimen-processing-procedure); Indicates the treatment step  applied to the specimen**

 A coded value specifying the procedure used to process the specimen.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "procedure")]
    pub procedure: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_procedure")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub procedure_ext: Option<FieldExtension>,
    /** **Material used in the processing step**

 Material used in the processing step.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "additive")]
    pub additive: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_additive")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub additive_ext: Vec<Option<FieldExtension>>,
    /** **Date and time of specimen processing**

 A record of the time or period when the specimen processing occurred.  For example the time of sample fixation or the period of time the sample was in formalin.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub time: Option<SpecimenProcessingTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub time_ext: Option<SpecimenProcessingTimeExtension>,
}
#[cfg(feature = "builders")]
impl SpecimenProcessing {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SpecimenProcessingBuilder {
        SpecimenProcessingBuilder::default()
    }
}
/// Choice of types for the time[x] field in SpecimenProcessing
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SpecimenProcessingTime {
    /// Variant accepting the DateTime type.
    #[serde(rename = "timeDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "timePeriod")]
    Period(Period),
}
/// Extension value for SpecimenProcessingTime.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SpecimenProcessingTimeExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_timeDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_timePeriod")]
    Period(FieldExtension),
}
/// Sub-fields of the container field in Specimen
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SpecimenContainerBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SpecimenContainer {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Id for the container**

 Id for container. There may be multiple; a manufacturer's bar code, lab assigned identifier, etc. The container ID may differ from the specimen id in some circumstances.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Textual description of the container**

 Textual description of the container.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **[SpecimenContainerType](http://hl7.org/fhir/ValueSet/specimen-container-type); Kind of container directly associated with specimen**

 The type of container associated with the specimen (e.g. slide, aliquot, etc.).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Container volume or size**

 The capacity (volume or other measure) the container may contain.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "capacity")]
    pub capacity: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_capacity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub capacity_ext: Option<FieldExtension>,
    /** **Quantity of specimen within container**

 The quantity of specimen in the container; may be volume, dimensions, or other appropriate measurements, depending on the specimen type.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "specimenQuantity")]
    pub specimen_quantity: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_specimenQuantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub specimen_quantity_ext: Option<FieldExtension>,
    /** **Additive associated with container**

 Introduced substance to preserve, maintain or enhance the specimen. Examples: Formalin, Citrate, EDTA.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub additive: Option<SpecimenContainerAdditive>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub additive_ext: Option<SpecimenContainerAdditiveExtension>,
}
#[cfg(feature = "builders")]
impl SpecimenContainer {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SpecimenContainerBuilder {
        SpecimenContainerBuilder::default()
    }
}
/// Choice of types for the additive[x] field in SpecimenContainer
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SpecimenContainerAdditive {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "additiveCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "additiveReference")]
    Reference(Reference),
}
/// Extension value for SpecimenContainerAdditive.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SpecimenContainerAdditiveExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_additiveCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_additiveReference")]
    Reference(FieldExtension),
}
/** Base StructureDefinition for StructureDefinition Resource

 **[StructureDefinition](http://hl7.org/fhir/StructureDefinition/StructureDefinition) v3.0.2**

 Structural Definition

 A definition of a FHIR structure. This resource is used to describe the underlying resources, data types defined in FHIR, and also for describing extensions and constraints on resources and data types.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct StructureDefinition(pub Box<StructureDefinitionInner>);
/** Base StructureDefinition for StructureDefinition Resource

 **[StructureDefinition](http://hl7.org/fhir/StructureDefinition/StructureDefinition) v3.0.2**

 Structural Definition

 A definition of a FHIR structure. This resource is used to describe the underlying resources, data types defined in FHIR, and also for describing extensions and constraints on resources and data types.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "StructureDefinitionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct StructureDefinitionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "StructureDefinition::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::StructureDefinition", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical URI to reference this structure definition (globally unique)**

 An absolute URI that is used to identify this structure definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure definition is (or will be) published. The URL SHOULD include the major version of the structure definition. For more information see [Technical and Business Versions](resource.html#versions).

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred.  Multiple instances may share the same url if they have a distinct version. */
    #[serde(rename = "url")]
    pub url: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Additional identifier for the structure definition**

 A formal identifier that is used to identify this structure definition when it is represented in other formats, or referenced in a specification, model, design or an instance.

 Typically, this is used for identifiers that can go in an HL7 V3 II (instance identifier) data type, e.g., to identify this structure definition outside of FHIR, where it is not possible to use the logical URI. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Business version of the structure definition**

 The identifier that is used to identify this version of the structure definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the structure definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.

 There may be different structure definition instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a refrence to a particular business version of the structure definition with the format [url]|[version]. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Name for this structure definition (computer friendly)**

 A natural language name identifying the structure definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.

 The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure that it is computable friendly. */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Name for this structure definition (human friendly)**

 A short, descriptive, user-friendly title for the structure definition.

 This name does not need to be machine-processing friendly and may contain punctuation, white-space, etc. Applications don't have to use this name, but can always fall back to it. The title also corresponds to the label for the root element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this structure definition. Enables tracking the life-cycle of the content.

 Allows filtering of structure definitions that are appropriate for use vs. not.
This is labeled as "Is Modifier" because applications should not use a retired structure definition without due consideration. */
    #[serde(rename = "status")]
    pub status: codes::PublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **For testing purposes, not real usage**

 A boolean value to indicate that this structure definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of structure definition that are appropriate for use vs. not. This is labeled as "Is Modifier" because applications should not use an experimental structure definition in production. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "experimental")]
    pub experimental: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_experimental")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub experimental_ext: Option<FieldExtension>,
    /** **Date this was last changed**

 The date  (and optionally time) when the structure definition was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the structure definition changes.

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the structure definition. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Name of the publisher (organization or individual)**

 The name of the individual or organization that published the structure definition.

 Usually an organization, but may be an individual. The publisher (or steward) of the structure definition is the organization or individual primarily responsible for the maintenance and upkeep of the structure definition. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the structure definition. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisher")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_ext: Option<FieldExtension>,
    /** **Contact details for the publisher**

 Contact details to assist a user in finding and communicating with the publisher.

 May be a web site, an email address, a telephone number, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Natural language description of the structure definition**

 A free text natural language description of the structure definition from a consumer's perspective.

 This description can be used to capture details such as why the structure definition was built, comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the structure definition as conveyed in the 'text' field of the resource itself. This item SHOULD be populated unless the information is available from context (e.g. the language of the profile is presumed to be the predominant language in the place the profile was created). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Context the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate structure definition instances.

 When multiple useContexts are specified, there is no expectation whether all or any of the contexts apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useContext")]
    pub use_context: Vec<Option<UsageContext>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_useContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_context_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Intended jurisdiction for structure definition (if applicable)**

 A legal or geographic region in which the structure definition is intended to be used.

 It may be possible for the structure definition to be used in jurisdictions other than those for which it was originally designed or intended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **Why this structure definition is defined**

 Explaination of why this structure definition is needed and why it has been designed as it has.

 This element does not describe the usage of the structure definition Instead  it provides traceability of ''why'' the resource is either needed or ''why'' it is defined as it is.  This may be used to point to source materials or specifications that drove the structure of this structure definition. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purpose")]
    pub purpose: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_purpose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub purpose_ext: Option<FieldExtension>,
    /** **Use and/or publishing restrictions**

 A copyright statement relating to the structure definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the structure definition.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyright")]
    pub copyright: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyright")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_ext: Option<FieldExtension>,
    /** **[StructureDefinitionCode](http://hl7.org/fhir/ValueSet/profile-code); Assist with indexing and finding**

 A set of key words or terms from external terminologies that may be used to assist with indexing and searching of templates.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "keyword")]
    pub keyword: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_keyword")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub keyword_ext: Vec<Option<FieldExtension>>,
    /** **FHIR Version this StructureDefinition targets**

 The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is 3.0.2 for this version.

 A StructureDefinition does not need to specify the target it applies to,as StructureDefinitions will often be valid across multiple versions of FHIR. FHIR tooling can determine whether a StructureDefinition is consistent with a particular StructureDefinition if desired. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "fhirVersion")]
    pub fhir_version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_fhirVersion")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub fhir_version_ext: Option<FieldExtension>,
    /** **External specification that the content is mapped to**

 An external specification that the content is mapped to.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "mapping")]
    pub mapping: Vec<Option<StructureDefinitionMapping>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_mapping")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub mapping_ext: Vec<Option<FieldExtension>>,
    /** **[StructureDefinitionKind](http://hl7.org/fhir/ValueSet/structure-definition-kind); primitive-type | complex-type | resource | logical**

 Defines the kind of structure that this definition is describing.

 */
    #[serde(rename = "kind")]
    pub kind: codes::StructureDefinitionKind,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_kind")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub kind_ext: Option<FieldExtension>,
    /** **Whether the structure is abstract**

 Whether structure this definition describes is abstract or not  - that is, whether the structure is not intended to be instantiated. For Resources and Data types, abstract types will never be exchanged  between systems.

 Abstract Resources cannot be instantiated - a concrete sub-type must be used. Abstract datatypes and extensions cannot be used in an instance. For logical models, the exact implication of "abstract" will rest with the author, depending how the logical model is used. Flagging a constraint structure as abstract conveys design intent but makes no difference to how the structure definition is handled. Note that inline declared elements that are given the type "Element" in the profile, but have children described, are anonymous concrete types that specialise Element. */
    #[serde(rename = "abstract")]
    pub r#abstract: bool,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_abstract")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#abstract_ext: Option<FieldExtension>,
    /** **[ExtensionContext](http://hl7.org/fhir/ValueSet/extension-context); resource | datatype | extension**

 If this is an extension, Identifies the context within FHIR resources where the extension can be used.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contextType")]
    pub context_type: Option<codes::ExtensionContext>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_contextType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_type_ext: Option<FieldExtension>,
    /** **Where the extension can be used in instances**

 Identifies the types of resource or data type elements to which the extension can be applied.

 If the context is an element that can have multiple types, then use (e.g.) value[x] if the extension works on all choice types, or otherwise an enumeration of explicitly named elements if not. Note that a context of "string" doesn't mean that the extension can be used with one of the string patterns such as "id" etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub context_ext: Vec<Option<FieldExtension>>,
    /** **FHIRPath invariants - when the extension can be used**

 A set of rules as Fluent Invariants about when the extension can be used (e.g. co-occurrence variants for the extension).

 All the rules must be true. When evaluating the invariant, the fluentpath focus is the element that holds the extension, and %extension refers to the extension itself. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contextInvariant")]
    pub context_invariant: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contextInvariant")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub context_invariant_ext: Vec<Option<FieldExtension>>,
    /** **[FHIRDefinedTypeExt](http://hl7.org/fhir/ValueSet/defined-types); Type defined or constrained by this structure**

 The type this structure describes. If the derivation kind is 'specialization' then this is the master definition for a type, and there is always one of these (a data type, an extension, a resource, including abstract ones). Otherwise the structure definition is a constraint on the stated type (and in this case, the type cannot be an abstract type).

 Note that in the case of constraints, the type could be determined by chasing through the baseDefinition references until a concrete structure (derivation = specialization) is reached, or by looking at the path of the first element in the snapshot - if present - but providing the type directly makes for simpler tooling and indexing. */
    #[serde(rename = "type")]
    pub r#type: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Definition that this type is constrained/specialized from**

 An absolute URI that is the base structure from which this type is derived, either by specialization or constraint.

 If differential constraints are specified in this structure, they are applied to the base in a "differential" fashion. If there is no base, then the differential constraints cannot be provided (snapshot only). Differential structures are useful for the editing perspective, and snapshot structures are suitable for operational use. The FHIR Project provides a number of tools/services to populate snapshots from differential constraints. Logical Models have a base of "Element" or another logical model. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "baseDefinition")]
    pub base_definition: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_baseDefinition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub base_definition_ext: Option<FieldExtension>,
    /** **[TypeDerivationRule](http://hl7.org/fhir/ValueSet/type-derivation-rule); specialization | constraint - How relates to base definition**

 How the type relates to the baseDefinition.

 If the definition is a specialization, then it adds new elements in the differential, and the snapshot includes the inherited elements.

If the definition is a constraint, then it can not define new elements, it can only make new rules about existing content (see [Profiling Resources](profiling.html#resources)). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "derivation")]
    pub derivation: Option<codes::TypeDerivationRule>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_derivation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub derivation_ext: Option<FieldExtension>,
    /** **Snapshot view of the structure**

 A snapshot view is expressed in a stand alone form that can be used and interpreted without considering the base StructureDefinition.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "snapshot")]
    pub snapshot: Option<StructureDefinitionSnapshot>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_snapshot")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub snapshot_ext: Option<FieldExtension>,
    /** **Differential view of the structure**

 A differential view is expressed relative to the base StructureDefinition - a statement of differences that it applies.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "differential")]
    pub differential: Option<StructureDefinitionDifferential>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_differential")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub differential_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl StructureDefinitionBuilder {
    #[doc = concat!("Finalize building ", "StructureDefinition", ".")]
    pub fn build(self) -> Result<StructureDefinition, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<StructureDefinitionInner> for StructureDefinition {
    fn from(inner: StructureDefinitionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for StructureDefinition {
    type Target = StructureDefinitionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for StructureDefinition {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl StructureDefinition {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> StructureDefinitionBuilder {
        StructureDefinitionBuilder::default()
    }
}
impl StructureDefinition {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::StructureDefinition
    }
}
/// Sub-fields of the mapping field in StructureDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "StructureDefinitionMappingBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct StructureDefinitionMapping {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Internal id when this mapping is used**

 An Internal id that is used to identify this mapping set when specific mappings are made.

 The specification is described once, with general comments, and then specific mappings are made that reference this declaration. */
    #[serde(rename = "identity")]
    pub identity: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identity_ext: Option<FieldExtension>,
    /** **Identifies what this mapping refers to**

 An absolute URI that identifies the specification that this mapping is expressed to.

 A formal identity for the specification being mapped to helps with identifying maps consistently. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "uri")]
    pub uri: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_uri")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub uri_ext: Option<FieldExtension>,
    /** **Names what this mapping refers to**

 A name for the specification that is being mapped to.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Versions, Issues, Scope limitations etc.**

 Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "comment")]
    pub comment: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_comment")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub comment_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl StructureDefinitionMapping {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> StructureDefinitionMappingBuilder {
        StructureDefinitionMappingBuilder::default()
    }
}
/// Sub-fields of the snapshot field in StructureDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "StructureDefinitionSnapshotBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct StructureDefinitionSnapshot {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Definition of elements in the resource (if no StructureDefinition)**

 Captures constraints on each element within the resource.

 */
    #[serde(rename = "element")]
    pub element: Vec<Option<ElementDefinition>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_element")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub element_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl StructureDefinitionSnapshot {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> StructureDefinitionSnapshotBuilder {
        StructureDefinitionSnapshotBuilder::default()
    }
}
/// Sub-fields of the differential field in StructureDefinition
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "StructureDefinitionDifferentialBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct StructureDefinitionDifferential {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Definition of elements in the resource (if no StructureDefinition)**

 Captures constraints on each element within the resource.

 */
    #[serde(rename = "element")]
    pub element: Vec<Option<ElementDefinition>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_element")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub element_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl StructureDefinitionDifferential {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> StructureDefinitionDifferentialBuilder {
        StructureDefinitionDifferentialBuilder::default()
    }
}
/** Base StructureDefinition for StructureMap Resource

 **[StructureMap](http://hl7.org/fhir/StructureDefinition/StructureMap) v3.0.2**

 A Map of relationships between 2 structures that can be used to transform data

 A Map of relationships between 2 structures that can be used to transform data.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct StructureMap(pub Box<StructureMapInner>);
/** Base StructureDefinition for StructureMap Resource

 **[StructureMap](http://hl7.org/fhir/StructureDefinition/StructureMap) v3.0.2**

 A Map of relationships between 2 structures that can be used to transform data

 A Map of relationships between 2 structures that can be used to transform data.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "StructureMapBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct StructureMapInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "StructureMap::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::StructureMap", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical URI to reference this structure map (globally unique)**

 An absolute URI that is used to identify this structure map when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure map is (or will be) published. The URL SHOULD include the major version of the structure map. For more information see [Technical and Business Versions](resource.html#versions).

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred.  Multiple instances may share the same url if they have a distinct version. */
    #[serde(rename = "url")]
    pub url: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Additional identifier for the structure map**

 A formal identifier that is used to identify this structure map when it is represented in other formats, or referenced in a specification, model, design or an instance.

 Typically, this is used for identifiers that can go in an HL7 V3 II (instance identifier) data type, e.g., to identify this structure map outside of FHIR, where it is not possible to use the logical URI. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Business version of the structure map**

 The identifier that is used to identify this version of the structure map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the structure map author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.

 There may be different structure map instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a refrence to a particular business version of the structure map with the format [url]|[version]. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Name for this structure map (computer friendly)**

 A natural language name identifying the structure map. This name should be usable as an identifier for the module by machine processing applications such as code generation.

 The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure that it is computable friendly. */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Name for this structure map (human friendly)**

 A short, descriptive, user-friendly title for the structure map.

 This name does not need to be machine-processing friendly and may contain punctuation, white-space, etc. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this structure map. Enables tracking the life-cycle of the content.

 Allows filtering of structure maps that are appropriate for use vs. not.
This is labeled as "Is Modifier" because applications should not use a retired structure map without due consideration. */
    #[serde(rename = "status")]
    pub status: codes::PublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **For testing purposes, not real usage**

 A boolean value to indicate that this structure map is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of structure map that are appropriate for use vs. not. This is labeled as "Is Modifier" because applications should not use an experimental structure map in production. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "experimental")]
    pub experimental: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_experimental")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub experimental_ext: Option<FieldExtension>,
    /** **Date this was last changed**

 The date  (and optionally time) when the structure map was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the structure map changes.

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the structure map. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Name of the publisher (organization or individual)**

 The name of the individual or organization that published the structure map.

 Usually an organization, but may be an individual. The publisher (or steward) of the structure map is the organization or individual primarily responsible for the maintenance and upkeep of the structure map. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the structure map. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisher")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_ext: Option<FieldExtension>,
    /** **Contact details for the publisher**

 Contact details to assist a user in finding and communicating with the publisher.

 May be a web site, an email address, a telephone number, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Natural language description of the structure map**

 A free text natural language description of the structure map from a consumer's perspective.

 This description can be used to capture details such as why the structure map was built, comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the structure map as conveyed in the 'text' field of the resource itself. This item SHOULD be populated unless the information is available from context (e.g. the language of the profile is presumed to be the predominant language in the place the profile was created). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Context the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate structure map instances.

 When multiple useContexts are specified, there is no expectation whether all or any of the contexts apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useContext")]
    pub use_context: Vec<Option<UsageContext>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_useContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_context_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Intended jurisdiction for structure map (if applicable)**

 A legal or geographic region in which the structure map is intended to be used.

 It may be possible for the structure map to be used in jurisdictions other than those for which it was originally designed or intended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **Why this structure map is defined**

 Explaination of why this structure map is needed and why it has been designed as it has.

 This element does not describe the usage of the structure map Instead  it provides traceability of ''why'' the resource is either needed or ''why'' it is defined as it is.  This may be used to point to source materials or specifications that drove the structure of this structure map. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purpose")]
    pub purpose: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_purpose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub purpose_ext: Option<FieldExtension>,
    /** **Use and/or publishing restrictions**

 A copyright statement relating to the structure map and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the structure map.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyright")]
    pub copyright: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyright")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_ext: Option<FieldExtension>,
    /** **Structure Definition used by this map**

 A structure definition used by this map. The structure definition may describe instances that are converted, or the instances that are produced.

 It is not necessary for a structure map to identify any dependent structures, though not losting them may restrict its usefulness. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "structure")]
    pub structure: Vec<Option<StructureMapStructure>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_structure")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub structure_ext: Vec<Option<FieldExtension>>,
    /** **Other maps used by this map (canonical URLs)**

 Other maps used by this map (canonical URLs).

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "import")]
    pub import: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_import")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub import_ext: Vec<Option<FieldExtension>>,
    /** **Named sections for reader convenience**

 Organizes the mapping into managable chunks for human review/ease of maintenance.

 */
    #[serde(rename = "group")]
    pub group: Vec<Option<StructureMapGroup>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_group")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub group_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl StructureMapBuilder {
    #[doc = concat!("Finalize building ", "StructureMap", ".")]
    pub fn build(self) -> Result<StructureMap, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<StructureMapInner> for StructureMap {
    fn from(inner: StructureMapInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for StructureMap {
    type Target = StructureMapInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for StructureMap {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl StructureMap {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> StructureMapBuilder {
        StructureMapBuilder::default()
    }
}
impl StructureMap {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::StructureMap
    }
}
/// Sub-fields of the structure field in StructureMap
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "StructureMapStructureBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct StructureMapStructure {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Canonical URL for structure definition**

 The canonical URL that identifies the structure.

 */
    #[serde(rename = "url")]
    pub url: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **[StructureMapModelMode](http://hl7.org/fhir/ValueSet/map-model-mode); source | queried | target | produced**

 How the referenced structure is used in this mapping.

 */
    #[serde(rename = "mode")]
    pub mode: codes::StructureMapModelMode,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_mode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub mode_ext: Option<FieldExtension>,
    /** **Name for type in this map**

 The name used for this type in the map.

 This is needed if both types have the same name (e.g. version conversion). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "alias")]
    pub alias: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_alias")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub alias_ext: Option<FieldExtension>,
    /** **Documentation on use of structure**

 Documentation that describes how the structure is used in the mapping.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "documentation")]
    pub documentation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_documentation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub documentation_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl StructureMapStructure {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> StructureMapStructureBuilder {
        StructureMapStructureBuilder::default()
    }
}
/// Sub-fields of the group field in StructureMap
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "StructureMapGroupBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct StructureMapGroup {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Human-readable label**

 A unique name for the group for the convenience of human readers.

 */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Another group that this group adds rules to**

 Another group that this group adds rules to.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extends")]
    pub extends: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_extends")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub extends_ext: Option<FieldExtension>,
    /** **[StructureMapGroupTypeMode](http://hl7.org/fhir/ValueSet/map-group-type-mode); none | types | type-and-types**

 If this is the default rule set to apply for thie source type, or this combination of types.

 Not applicable if the underlying model is untyped. There can only be one default mapping for any particular type combination. */
    #[serde(rename = "typeMode")]
    pub type_mode: codes::StructureMapGroupTypeMode,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_typeMode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub type_mode_ext: Option<FieldExtension>,
    /** **Additional description/explaination for group**

 Additional supporting documentation that explains the purpose of the group and the types of mappings within it.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "documentation")]
    pub documentation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_documentation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub documentation_ext: Option<FieldExtension>,
    /** **Named instance provided when invoking the map**

 A name assigned to an instance of data. The instance must be provided when the mapping is invoked.

 If no inputs are named, then the entry mappings are type based. */
    #[serde(rename = "input")]
    pub input: Vec<Option<StructureMapGroupInput>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_input")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub input_ext: Vec<Option<FieldExtension>>,
    /** **Transform Rule from source to target**

 Transform Rule from source to target.

 */
    #[serde(rename = "rule")]
    pub rule: Vec<Option<StructureMapGroupRule>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_rule")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub rule_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl StructureMapGroup {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> StructureMapGroupBuilder {
        StructureMapGroupBuilder::default()
    }
}
/// Sub-fields of the input field in StructureMapGroup
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "StructureMapGroupInputBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct StructureMapGroupInput {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Name for this instance of data**

 Name for this instance of data.

 */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Type for this instance of data**

 Type for this instance of data.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[StructureMapInputMode](http://hl7.org/fhir/ValueSet/map-input-mode); source | target**

 Mode for this instance of data.

 */
    #[serde(rename = "mode")]
    pub mode: codes::StructureMapInputMode,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_mode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub mode_ext: Option<FieldExtension>,
    /** **Documentation for this instance of data**

 Documentation for this instance of data.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "documentation")]
    pub documentation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_documentation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub documentation_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl StructureMapGroupInput {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> StructureMapGroupInputBuilder {
        StructureMapGroupInputBuilder::default()
    }
}
/// Sub-fields of the rule field in StructureMapGroup
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "StructureMapGroupRuleBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct StructureMapGroupRule {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Name of the rule for internal references**

 Name of the rule for internal references.

 */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Source inputs to the mapping**

 Source inputs to the mapping.

 */
    #[serde(rename = "source")]
    pub source: Vec<Option<StructureMapGroupRuleSource>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_source")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub source_ext: Vec<Option<FieldExtension>>,
    /** **Content to create because of this mapping rule**

 Content to create because of this mapping rule.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "target")]
    pub target: Vec<Option<StructureMapGroupRuleTarget>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_target")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub target_ext: Vec<Option<FieldExtension>>,
    /** **Rules contained in this rule**

 Rules contained in this rule.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "rule")]
    pub rule: Vec<Option<StructureMapGroupRule>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_rule")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub rule_ext: Vec<Option<FieldExtension>>,
    /** **Which other rules to apply in the context of this rule**

 Which other rules to apply in the context of this rule.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dependent")]
    pub dependent: Vec<Option<StructureMapGroupRuleDependent>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_dependent")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub dependent_ext: Vec<Option<FieldExtension>>,
    /** **Documentation for this instance of data**

 Documentation for this instance of data.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "documentation")]
    pub documentation: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_documentation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub documentation_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl StructureMapGroupRule {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> StructureMapGroupRuleBuilder {
        StructureMapGroupRuleBuilder::default()
    }
}
/// Sub-fields of the source field in StructureMapGroupRule
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "StructureMapGroupRuleSourceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct StructureMapGroupRuleSource {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Type or variable this rule applies to**

 Type or variable this rule applies to.

 */
    #[serde(rename = "context")]
    pub context: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **Specified minimum cardinality**

 Specified minimum cardinality for the element. This is optional; if present, it acts an implicit check on the input content.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "min")]
    pub min: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_min")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub min_ext: Option<FieldExtension>,
    /** **Specified maximum cardinality (number or *)**

 Specified maximum cardinality for the element - a number or a "*". This is optional; if present, it acts an implicit check on the input content (* just serves as documentation; it's the default value).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "max")]
    pub max: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_max")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub max_ext: Option<FieldExtension>,
    /** **Rule only applies if source has this type**

 Specified type for the element. This works as a condition on the mapping - use for polymorphic elements.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Default value if no value exists**

 A value to use if there is no existing value in the source object.

 If there's a default value on an item that can repeat, it will only be used once. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub default_value: Option<StructureMapGroupRuleSourceDefaultValue>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub default_value_ext: Option<StructureMapGroupRuleSourceDefaultValueExtension>,
    /** **Optional field for this source**

 Optional field for this source.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "element")]
    pub element: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_element")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub element_ext: Option<FieldExtension>,
    /** **[StructureMapSourceListMode](http://hl7.org/fhir/ValueSet/map-source-list-mode); first | not_first | last | not_last | only_one**

 How to handle the list mode for this element.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "listMode")]
    pub list_mode: Option<codes::StructureMapSourceListMode>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_listMode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub list_mode_ext: Option<FieldExtension>,
    /** **Named context for field, if a field is specified**

 Named context for field, if a field is specified.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "variable")]
    pub variable: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_variable")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub variable_ext: Option<FieldExtension>,
    /** **FHIRPath expression  - must be true or the rule does not apply**

 FHIRPath expression  - must be true or the rule does not apply.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "condition")]
    pub condition: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_condition")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub condition_ext: Option<FieldExtension>,
    /** **FHIRPath expression  - must be true or the mapping engine throws an error instead of completing**

 FHIRPath expression  - must be true or the mapping engine throws an error instead of completing.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "check")]
    pub check: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_check")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub check_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl StructureMapGroupRuleSource {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> StructureMapGroupRuleSourceBuilder {
        StructureMapGroupRuleSourceBuilder::default()
    }
}
/// Choice of types for the defaultValue[x] field in StructureMapGroupRuleSource
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum StructureMapGroupRuleSourceDefaultValue {
    /// Variant accepting the Base64Binary type.
    #[serde(rename = "defaultValueBase64Binary")]
    Base64Binary(Base64Binary),
    /// Variant accepting the Boolean type.
    #[serde(rename = "defaultValueBoolean")]
    Boolean(bool),
    /// Variant accepting the Code type.
    #[serde(rename = "defaultValueCode")]
    Code(String),
    /// Variant accepting the Date type.
    #[serde(rename = "defaultValueDate")]
    Date(Date),
    /// Variant accepting the DateTime type.
    #[serde(rename = "defaultValueDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Decimal type.
    #[serde(rename = "defaultValueDecimal")]
    Decimal(f64),
    /// Variant accepting the Id type.
    #[serde(rename = "defaultValueId")]
    Id(String),
    /// Variant accepting the Instant type.
    #[serde(rename = "defaultValueInstant")]
    Instant(Instant),
    /// Variant accepting the Integer type.
    #[serde(rename = "defaultValueInteger")]
    Integer(i32),
    /// Variant accepting the Markdown type.
    #[serde(rename = "defaultValueMarkdown")]
    Markdown(String),
    /// Variant accepting the Oid type.
    #[serde(rename = "defaultValueOid")]
    Oid(String),
    /// Variant accepting the PositiveInt type.
    #[serde(rename = "defaultValuePositiveInt")]
    PositiveInt(NonZeroU32),
    /// Variant accepting the String type.
    #[serde(rename = "defaultValueString")]
    String(String),
    /// Variant accepting the Time type.
    #[serde(rename = "defaultValueTime")]
    Time(Time),
    /// Variant accepting the UnsignedInt type.
    #[serde(rename = "defaultValueUnsignedInt")]
    UnsignedInt(u32),
    /// Variant accepting the Uri type.
    #[serde(rename = "defaultValueUri")]
    Uri(String),
    /// Variant accepting the Address type.
    #[serde(rename = "defaultValueAddress")]
    Address(Address),
    /// Variant accepting the Age type.
    #[serde(rename = "defaultValueAge")]
    Age(Age),
    /// Variant accepting the Annotation type.
    #[serde(rename = "defaultValueAnnotation")]
    Annotation(Annotation),
    /// Variant accepting the Attachment type.
    #[serde(rename = "defaultValueAttachment")]
    Attachment(Attachment),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "defaultValueCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Coding type.
    #[serde(rename = "defaultValueCoding")]
    Coding(Coding),
    /// Variant accepting the ContactPoint type.
    #[serde(rename = "defaultValueContactPoint")]
    ContactPoint(ContactPoint),
    /// Variant accepting the Count type.
    #[serde(rename = "defaultValueCount")]
    Count(Count),
    /// Variant accepting the Distance type.
    #[serde(rename = "defaultValueDistance")]
    Distance(Distance),
    /// Variant accepting the Duration type.
    #[serde(rename = "defaultValueDuration")]
    Duration(Duration),
    /// Variant accepting the HumanName type.
    #[serde(rename = "defaultValueHumanName")]
    HumanName(HumanName),
    /// Variant accepting the Identifier type.
    #[serde(rename = "defaultValueIdentifier")]
    Identifier(Identifier),
    /// Variant accepting the Money type.
    #[serde(rename = "defaultValueMoney")]
    Money(Money),
    /// Variant accepting the Period type.
    #[serde(rename = "defaultValuePeriod")]
    Period(Period),
    /// Variant accepting the Quantity type.
    #[serde(rename = "defaultValueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Range type.
    #[serde(rename = "defaultValueRange")]
    Range(Range),
    /// Variant accepting the Ratio type.
    #[serde(rename = "defaultValueRatio")]
    Ratio(Ratio),
    /// Variant accepting the Reference type.
    #[serde(rename = "defaultValueReference")]
    Reference(Reference),
    /// Variant accepting the SampledData type.
    #[serde(rename = "defaultValueSampledData")]
    SampledData(SampledData),
    /// Variant accepting the Signature type.
    #[serde(rename = "defaultValueSignature")]
    Signature(Signature),
    /// Variant accepting the Timing type.
    #[serde(rename = "defaultValueTiming")]
    Timing(Timing),
    /// Variant accepting the Meta type.
    #[serde(rename = "defaultValueMeta")]
    Meta(Meta),
}
/// Extension value for StructureMapGroupRuleSourceDefaultValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum StructureMapGroupRuleSourceDefaultValueExtension {
    /// Variant accepting the Base64Binary extension.
    #[serde(rename = "_defaultValueBase64Binary")]
    Base64Binary(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_defaultValueBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Code extension.
    #[serde(rename = "_defaultValueCode")]
    Code(FieldExtension),
    /// Variant accepting the Date extension.
    #[serde(rename = "_defaultValueDate")]
    Date(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_defaultValueDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Decimal extension.
    #[serde(rename = "_defaultValueDecimal")]
    Decimal(FieldExtension),
    /// Variant accepting the Id extension.
    #[serde(rename = "_defaultValueId")]
    Id(FieldExtension),
    /// Variant accepting the Instant extension.
    #[serde(rename = "_defaultValueInstant")]
    Instant(FieldExtension),
    /// Variant accepting the Integer extension.
    #[serde(rename = "_defaultValueInteger")]
    Integer(FieldExtension),
    /// Variant accepting the Markdown extension.
    #[serde(rename = "_defaultValueMarkdown")]
    Markdown(FieldExtension),
    /// Variant accepting the Oid extension.
    #[serde(rename = "_defaultValueOid")]
    Oid(FieldExtension),
    /// Variant accepting the PositiveInt extension.
    #[serde(rename = "_defaultValuePositiveInt")]
    PositiveInt(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_defaultValueString")]
    String(FieldExtension),
    /// Variant accepting the Time extension.
    #[serde(rename = "_defaultValueTime")]
    Time(FieldExtension),
    /// Variant accepting the UnsignedInt extension.
    #[serde(rename = "_defaultValueUnsignedInt")]
    UnsignedInt(FieldExtension),
    /// Variant accepting the Uri extension.
    #[serde(rename = "_defaultValueUri")]
    Uri(FieldExtension),
    /// Variant accepting the Address extension.
    #[serde(rename = "_defaultValueAddress")]
    Address(FieldExtension),
    /// Variant accepting the Age extension.
    #[serde(rename = "_defaultValueAge")]
    Age(FieldExtension),
    /// Variant accepting the Annotation extension.
    #[serde(rename = "_defaultValueAnnotation")]
    Annotation(FieldExtension),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_defaultValueAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_defaultValueCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_defaultValueCoding")]
    Coding(FieldExtension),
    /// Variant accepting the ContactPoint extension.
    #[serde(rename = "_defaultValueContactPoint")]
    ContactPoint(FieldExtension),
    /// Variant accepting the Count extension.
    #[serde(rename = "_defaultValueCount")]
    Count(FieldExtension),
    /// Variant accepting the Distance extension.
    #[serde(rename = "_defaultValueDistance")]
    Distance(FieldExtension),
    /// Variant accepting the Duration extension.
    #[serde(rename = "_defaultValueDuration")]
    Duration(FieldExtension),
    /// Variant accepting the HumanName extension.
    #[serde(rename = "_defaultValueHumanName")]
    HumanName(FieldExtension),
    /// Variant accepting the Identifier extension.
    #[serde(rename = "_defaultValueIdentifier")]
    Identifier(FieldExtension),
    /// Variant accepting the Money extension.
    #[serde(rename = "_defaultValueMoney")]
    Money(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_defaultValuePeriod")]
    Period(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_defaultValueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_defaultValueRange")]
    Range(FieldExtension),
    /// Variant accepting the Ratio extension.
    #[serde(rename = "_defaultValueRatio")]
    Ratio(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_defaultValueReference")]
    Reference(FieldExtension),
    /// Variant accepting the SampledData extension.
    #[serde(rename = "_defaultValueSampledData")]
    SampledData(FieldExtension),
    /// Variant accepting the Signature extension.
    #[serde(rename = "_defaultValueSignature")]
    Signature(FieldExtension),
    /// Variant accepting the Timing extension.
    #[serde(rename = "_defaultValueTiming")]
    Timing(FieldExtension),
    /// Variant accepting the Meta extension.
    #[serde(rename = "_defaultValueMeta")]
    Meta(FieldExtension),
}
/// Sub-fields of the target field in StructureMapGroupRule
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "StructureMapGroupRuleTargetBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct StructureMapGroupRuleTarget {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Type or variable this rule applies to**

 Type or variable this rule applies to.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **[StructureMapContextType](http://hl7.org/fhir/ValueSet/map-context-type); type | variable**

 How to interpret the context.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contextType")]
    pub context_type: Option<codes::StructureMapContextType>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_contextType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_type_ext: Option<FieldExtension>,
    /** **Field to create in the context**

 Field to create in the context.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "element")]
    pub element: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_element")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub element_ext: Option<FieldExtension>,
    /** **Named context for field, if desired, and a field is specified**

 Named context for field, if desired, and a field is specified.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "variable")]
    pub variable: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_variable")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub variable_ext: Option<FieldExtension>,
    /** **[StructureMapTargetListMode](http://hl7.org/fhir/ValueSet/map-target-list-mode); first | share | last | collate**

 If field is a list, how to manage the list.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "listMode")]
    pub list_mode: Vec<Option<codes::StructureMapTargetListMode>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_listMode")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub list_mode_ext: Vec<Option<FieldExtension>>,
    /** **Internal rule reference for shared list items**

 Internal rule reference for shared list items.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "listRuleId")]
    pub list_rule_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_listRuleId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub list_rule_id_ext: Option<FieldExtension>,
    /** **[StructureMapTransform](http://hl7.org/fhir/ValueSet/map-transform); create | copy +**

 How the data is copied / created.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "transform")]
    pub transform: Option<codes::StructureMapTransform>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_transform")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub transform_ext: Option<FieldExtension>,
    /** **Parameters to the transform**

 Parameters to the transform.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parameter")]
    pub parameter: Vec<Option<StructureMapGroupRuleTargetParameter>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_parameter")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub parameter_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl StructureMapGroupRuleTarget {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> StructureMapGroupRuleTargetBuilder {
        StructureMapGroupRuleTargetBuilder::default()
    }
}
/// Sub-fields of the parameter field in StructureMapGroupRuleTarget
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "StructureMapGroupRuleTargetParameterBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct StructureMapGroupRuleTargetParameter {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Parameter value - variable or literal**

 Parameter value - variable or literal.

 */
    #[serde(flatten)]
    pub value: StructureMapGroupRuleTargetParameterValue,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<StructureMapGroupRuleTargetParameterValueExtension>,
}
#[cfg(feature = "builders")]
impl StructureMapGroupRuleTargetParameter {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> StructureMapGroupRuleTargetParameterBuilder {
        StructureMapGroupRuleTargetParameterBuilder::default()
    }
}
/// Choice of types for the value[x] field in StructureMapGroupRuleTargetParameter
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum StructureMapGroupRuleTargetParameterValue {
    /// Variant accepting the Id type.
    #[serde(rename = "valueId")]
    Id(String),
    /// Variant accepting the String type.
    #[serde(rename = "valueString")]
    String(String),
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// Variant accepting the Integer type.
    #[serde(rename = "valueInteger")]
    Integer(i32),
    /// Variant accepting the Decimal type.
    #[serde(rename = "valueDecimal")]
    Decimal(f64),
}
/// Extension value for StructureMapGroupRuleTargetParameterValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum StructureMapGroupRuleTargetParameterValueExtension {
    /// Variant accepting the Id extension.
    #[serde(rename = "_valueId")]
    Id(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_valueString")]
    String(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Integer extension.
    #[serde(rename = "_valueInteger")]
    Integer(FieldExtension),
    /// Variant accepting the Decimal extension.
    #[serde(rename = "_valueDecimal")]
    Decimal(FieldExtension),
}
/// Sub-fields of the dependent field in StructureMapGroupRule
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "StructureMapGroupRuleDependentBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct StructureMapGroupRuleDependent {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Name of a rule or group to apply**

 Name of a rule or group to apply.

 */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Variable to pass to the rule or group**

 Variable to pass to the rule or group.

 */
    #[serde(rename = "variable")]
    pub variable: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_variable")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub variable_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl StructureMapGroupRuleDependent {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> StructureMapGroupRuleDependentBuilder {
        StructureMapGroupRuleDependentBuilder::default()
    }
}
/** Base StructureDefinition for Subscription Resource

 **[Subscription](http://hl7.org/fhir/StructureDefinition/Subscription) v3.0.2**

 A server push subscription criteria

 The subscription resource is used to define a push based subscription from a server to another system. Once a subscription is registered with the server, the server checks every resource that is created or updated, and if the resource matches the given criteria, it sends a message on the defined "channel" so that another system is able to take an appropriate action.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Subscription(pub Box<SubscriptionInner>);
/** Base StructureDefinition for Subscription Resource

 **[Subscription](http://hl7.org/fhir/StructureDefinition/Subscription) v3.0.2**

 A server push subscription criteria

 The subscription resource is used to define a push based subscription from a server to another system. Once a subscription is registered with the server, the server checks every resource that is created or updated, and if the resource matches the given criteria, it sends a message on the defined "channel" so that another system is able to take an appropriate action.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubscriptionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct SubscriptionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Subscription::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Subscription", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[SubscriptionStatus](http://hl7.org/fhir/ValueSet/subscription-status); requested | active | error | off**

 The status of the subscription, which marks the server state for managing the subscription.

 A client can only submit subscription resources in the requested or off state. Only the server can  move a subscription from requested to active, and then to error. Either the server or the client can turn a subscription off.

This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::SubscriptionStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **Contact details for source (e.g. troubleshooting)**

 Contact details for a human to contact about the subscription. The primary use of this for system administrator troubleshooting.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactPoint>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **When to automatically delete the subscription**

 The time for the server to turn the subscription off.

 The server is permitted to deviate from this time, but should observe it. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "end")]
    pub end: Option<Instant>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_end")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub end_ext: Option<FieldExtension>,
    /** **Description of why this subscription was created**

 A description of why this subscription is defined.

 */
    #[serde(rename = "reason")]
    pub reason: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reason_ext: Option<FieldExtension>,
    /** **Rule for server push criteria**

 The rules that the server should use to determine when to generate notifications for this subscription.

 The rules are a search criteria (without the [base] part). Like Bundle.entry.request.url, it has no leading "/". */
    #[serde(rename = "criteria")]
    pub criteria: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_criteria")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub criteria_ext: Option<FieldExtension>,
    /** **Latest error note**

 A record of the last error that occurred when the server processed a notification.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "error")]
    pub error: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_error")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub error_ext: Option<FieldExtension>,
    /** **The channel on which to report matches to the criteria**

 Details where to send notifications when resources are received that meet the criteria.

 */
    #[serde(rename = "channel")]
    pub channel: SubscriptionChannel,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_channel")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub channel_ext: Option<FieldExtension>,
    /** **[SubscriptionTag](http://hl7.org/fhir/ValueSet/subscription-tag); A tag to add to matching resources**

 A tag to add to any resource that matches the criteria, after the subscription is processed.

 So that other systems can tell which resources have been the subject of a notification. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "tag")]
    pub tag: Vec<Option<Coding>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_tag")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub tag_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SubscriptionBuilder {
    #[doc = concat!("Finalize building ", "Subscription", ".")]
    pub fn build(self) -> Result<Subscription, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<SubscriptionInner> for Subscription {
    fn from(inner: SubscriptionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Subscription {
    type Target = SubscriptionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Subscription {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Subscription {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> SubscriptionBuilder {
        SubscriptionBuilder::default()
    }
}
impl Subscription {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Subscription
    }
}
/// Sub-fields of the channel field in Subscription
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubscriptionChannelBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubscriptionChannel {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[SubscriptionChannelType](http://hl7.org/fhir/ValueSet/subscription-channel-type); rest-hook | websocket | email | sms | message**

 The type of channel to send notifications on.

 */
    #[serde(rename = "type")]
    pub r#type: codes::SubscriptionChannelType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Where the channel points to**

 The uri that describes the actual end-point to send messages to.

 For rest-hook, and websocket, the end-point must be an http: or https: URL; for email, a mailto: url, for sms, a tel: url, and for message the endpoint can be in any form of url the server understands (usually, http: or mllp:). The URI is allowed to be relative; in which case, it is relative to the server end-point (since their may be more than one, clients should avoid using relative URIs). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "endpoint")]
    pub endpoint: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_endpoint")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub endpoint_ext: Option<FieldExtension>,
    /** **Mimetype to send, or omit for no payload**

 The mime type to send the payload in - either application/fhir+xml, or application/fhir+json. If the payload is not present, then there is no payload in the notification, just a notification.

 Sending the payload has obvious security implications. The server is responsible for ensuring that the content is appropriately secured. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "payload")]
    pub payload: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_payload")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub payload_ext: Option<FieldExtension>,
    /** **Usage depends on the channel type**

 Additional headers / information to send as part of the notification.

 Exactly what these mean depend on the channel type. They can convey additional information to the recipient and/or meet security requirements; for example, support of multiple headers in the outgoing notifications for rest-hook type subscriptions. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "header")]
    pub header: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_header")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub header_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SubscriptionChannel {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubscriptionChannelBuilder {
        SubscriptionChannelBuilder::default()
    }
}
/** Base StructureDefinition for Substance Resource

 **[Substance](http://hl7.org/fhir/StructureDefinition/Substance) v3.0.2**

 A homogeneous material with a definite composition

 A homogeneous material with a definite composition.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Substance(pub Box<SubstanceInner>);
/** Base StructureDefinition for Substance Resource

 **[Substance](http://hl7.org/fhir/StructureDefinition/Substance) v3.0.2**

 A homogeneous material with a definite composition

 A homogeneous material with a definite composition.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct SubstanceInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Substance::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Substance", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Unique identifier**

 Unique identifier for the substance.

 This identifier is associated with the kind of substance in contrast to the  Substance.instance.identifier which is associated with the package/container. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[FHIRSubstanceStatus](http://hl7.org/fhir/ValueSet/substance-status); active | inactive | entered-in-error**

 A code to indicate if the substance is actively used.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<codes::FHIRSubstanceStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[SubstanceCategory](http://hl7.org/fhir/ValueSet/substance-category); What class/type of substance this is**

 A code that classifies the general type of substance.  This is used  for searching, sorting and display purposes.

 The level of granularity is defined by the category concepts in the value set.   More fine-grained filtering can be performed using the metadata and/or terminology hierarchy in Substance.code. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub category_ext: Vec<Option<FieldExtension>>,
    /** **[SubstanceCode](http://hl7.org/fhir/ValueSet/substance-code); What substance this is**

 A code (or set of codes) that identify this substance.

 This could be a reference to an externally defined code.  It could also be a locally assigned code (e.g. a formulary),  optionally with translations to the standard drug codes. */
    #[serde(rename = "code")]
    pub code: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Textual description of the substance, comments**

 A description of the substance - its appearance, handling requirements, and other usage notes.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **If this describes a specific package/container of the substance**

 Substance may be used to describe a kind of substance, or a specific package/container of the substance: an instance.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "instance")]
    pub instance: Vec<Option<SubstanceInstance>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_instance")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub instance_ext: Vec<Option<FieldExtension>>,
    /** **Composition information about the substance**

 A substance can be composed of other substances.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "ingredient")]
    pub ingredient: Vec<Option<SubstanceIngredient>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_ingredient")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub ingredient_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SubstanceBuilder {
    #[doc = concat!("Finalize building ", "Substance", ".")]
    pub fn build(self) -> Result<Substance, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<SubstanceInner> for Substance {
    fn from(inner: SubstanceInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Substance {
    type Target = SubstanceInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Substance {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Substance {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> SubstanceBuilder {
        SubstanceBuilder::default()
    }
}
impl Substance {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Substance
    }
}
/// Sub-fields of the instance field in Substance
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceInstanceBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceInstance {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Identifier of the package/container**

 Identifier associated with the package/container (usually a label affixed directly).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **When no longer valid to use**

 When the substance is no longer valid to use. For some substances, a single arbitrary date is used for expiry.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "expiry")]
    pub expiry: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_expiry")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub expiry_ext: Option<FieldExtension>,
    /** **Amount of substance in the package**

 The amount of the substance.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_quantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SubstanceInstance {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceInstanceBuilder {
        SubstanceInstanceBuilder::default()
    }
}
/// Sub-fields of the ingredient field in Substance
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SubstanceIngredientBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SubstanceIngredient {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Optional amount (concentration)**

 The amount of the ingredient in the substance - a concentration ratio.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<Ratio>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_quantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<FieldExtension>,
    /** **A component of the substance**

 Another substance that is a component of this substance.

 */
    #[serde(flatten)]
    pub substance: SubstanceIngredientSubstance,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub substance_ext: Option<SubstanceIngredientSubstanceExtension>,
}
#[cfg(feature = "builders")]
impl SubstanceIngredient {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SubstanceIngredientBuilder {
        SubstanceIngredientBuilder::default()
    }
}
/// Choice of types for the substance[x] field in SubstanceIngredient
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SubstanceIngredientSubstance {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "substanceCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "substanceReference")]
    Reference(Reference),
}
/// Extension value for SubstanceIngredientSubstance.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SubstanceIngredientSubstanceExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_substanceCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_substanceReference")]
    Reference(FieldExtension),
}
/** Base StructureDefinition for SupplyDelivery Resource

 **[SupplyDelivery](http://hl7.org/fhir/StructureDefinition/SupplyDelivery) v3.0.2**

 Delivery of bulk Supplies

 Record of delivery of what is supplied.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct SupplyDelivery(pub Box<SupplyDeliveryInner>);
/** Base StructureDefinition for SupplyDelivery Resource

 **[SupplyDelivery](http://hl7.org/fhir/StructureDefinition/SupplyDelivery) v3.0.2**

 Delivery of bulk Supplies

 Record of delivery of what is supplied.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SupplyDeliveryBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct SupplyDeliveryInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "SupplyDelivery::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::SupplyDelivery", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **External identifier**

 Identifier assigned by the dispensing facility when the item(s) is dispensed.

 This is assigned by the dispenser, and used to refer to this order in other external standards. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **Fulfills plan, proposal or order**

 A plan, proposal or order that is fulfilled in whole or in part by this event.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basedOn")]
    pub based_on: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_basedOn")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub based_on_ext: Vec<Option<FieldExtension>>,
    /** **Part of referenced event**

 A larger event of which this particular event is a component or step.

 Not to be used to link an event to an Encounter - use Event.context for that.

[The allowed reference resources may be adjusted as appropriate for the event resource]. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "partOf")]
    pub part_of: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_partOf")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub part_of_ext: Vec<Option<FieldExtension>>,
    /** **[SupplyDeliveryStatus](http://hl7.org/fhir/ValueSet/supplydelivery-status); in-progress | completed | abandoned | entered-in-error**

 A code specifying the state of the dispense event.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<codes::SupplyDeliveryStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **Patient for whom the item is supplied**

 A link to a resource representing the person whom the delivered item is for.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patient")]
    pub patient: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_ext: Option<FieldExtension>,
    /** **[SupplyDeliveryType](http://hl7.org/fhir/ValueSet/supplydelivery-type); Category of dispense event**

 Indicates the type of dispensing event that is performed. Examples include: Trial Fill, Completion of Trial, Partial Fill, Emergency Fill, Samples, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **The item that is delivered or supplied**

 The item that is being delivered or has been supplied.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "suppliedItem")]
    pub supplied_item: Option<SupplyDeliverySuppliedItem>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_suppliedItem")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub supplied_item_ext: Option<FieldExtension>,
    /** **When event occurred**

 The date or time(s) the activity occurred.

 [The list of types may be constrained as appropriate for the type of event]. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub occurrence: Option<SupplyDeliveryOccurrence>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub occurrence_ext: Option<SupplyDeliveryOccurrenceExtension>,
    /** **Dispenser**

 The individual responsible for dispensing the medication, supplier or device.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "supplier")]
    pub supplier: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_supplier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub supplier_ext: Option<FieldExtension>,
    /** **Where the Supply was sent**

 Identification of the facility/location where the Supply was shipped to, as part of the dispense event.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "destination")]
    pub destination: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_destination")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub destination_ext: Option<FieldExtension>,
    /** **Who collected the Supply**

 Identifies the person who picked up the Supply.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "receiver")]
    pub receiver: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_receiver")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub receiver_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl SupplyDeliveryBuilder {
    #[doc = concat!("Finalize building ", "SupplyDelivery", ".")]
    pub fn build(self) -> Result<SupplyDelivery, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<SupplyDeliveryInner> for SupplyDelivery {
    fn from(inner: SupplyDeliveryInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for SupplyDelivery {
    type Target = SupplyDeliveryInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for SupplyDelivery {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl SupplyDelivery {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> SupplyDeliveryBuilder {
        SupplyDeliveryBuilder::default()
    }
}
impl SupplyDelivery {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::SupplyDelivery
    }
}
/// Sub-fields of the suppliedItem field in SupplyDelivery
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SupplyDeliverySuppliedItemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SupplyDeliverySuppliedItem {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Amount dispensed**

 The amount of supply that has been dispensed. Includes unit of measure.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "quantity")]
    pub quantity: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_quantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<FieldExtension>,
    /** **Medication, Substance, or Device supplied**

 Identifies the medication, substance or device being dispensed. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub item: Option<SupplyDeliverySuppliedItemItem>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub item_ext: Option<SupplyDeliverySuppliedItemItemExtension>,
}
#[cfg(feature = "builders")]
impl SupplyDeliverySuppliedItem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SupplyDeliverySuppliedItemBuilder {
        SupplyDeliverySuppliedItemBuilder::default()
    }
}
/// Choice of types for the item[x] field in SupplyDeliverySuppliedItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SupplyDeliverySuppliedItemItem {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "itemCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "itemReference")]
    Reference(Reference),
}
/// Extension value for SupplyDeliverySuppliedItemItem.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SupplyDeliverySuppliedItemItemExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_itemCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_itemReference")]
    Reference(FieldExtension),
}
/// Choice of types for the occurrence[x] field in SupplyDelivery
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SupplyDeliveryOccurrence {
    /// Variant accepting the DateTime type.
    #[serde(rename = "occurrenceDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "occurrencePeriod")]
    Period(Period),
    /// Variant accepting the Timing type.
    #[serde(rename = "occurrenceTiming")]
    Timing(Timing),
}
/// Extension value for SupplyDeliveryOccurrence.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SupplyDeliveryOccurrenceExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_occurrenceDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_occurrencePeriod")]
    Period(FieldExtension),
    /// Variant accepting the Timing extension.
    #[serde(rename = "_occurrenceTiming")]
    Timing(FieldExtension),
}
/** Base StructureDefinition for SupplyRequest Resource

 **[SupplyRequest](http://hl7.org/fhir/StructureDefinition/SupplyRequest) v3.0.2**

 Request for a medication, substance or device

 A record of a request for a medication, substance or device used in the healthcare setting.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct SupplyRequest(pub Box<SupplyRequestInner>);
/** Base StructureDefinition for SupplyRequest Resource

 **[SupplyRequest](http://hl7.org/fhir/StructureDefinition/SupplyRequest) v3.0.2**

 Request for a medication, substance or device

 A record of a request for a medication, substance or device used in the healthcare setting.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SupplyRequestBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct SupplyRequestInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "SupplyRequest::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::SupplyRequest", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Unique identifier**

 Unique identifier for this supply request.

 This is assigned by the requester, and used to refer to this order in other external standards. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **[SupplyRequestStatus](http://hl7.org/fhir/ValueSet/supplyrequest-status); draft | active | suspended +**

 Status of the supply request.

 This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<codes::SupplyRequestStatus>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[SupplyRequestKind](http://hl7.org/fhir/ValueSet/supplyrequest-kind); The kind of supply (central, non-stock, etc.)**

 Category of supply, e.g.  central, non-stock, etc. This is used to support work flows associated with the supply process.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "category")]
    pub category: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_category")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub category_ext: Option<FieldExtension>,
    /** **[RequestPriority](http://hl7.org/fhir/ValueSet/request-priority); routine | urgent | asap | stat**

 Indicates how quickly this SupplyRequest should be addressed with respect to other requests.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "priority")]
    pub priority: Option<codes::RequestPriority>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_priority")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub priority_ext: Option<FieldExtension>,
    /** **The item being requested**

 The item being requested.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "orderedItem")]
    pub ordered_item: Option<SupplyRequestOrderedItem>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_orderedItem")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub ordered_item_ext: Option<FieldExtension>,
    /** **When the request should be fulfilled**

 When the request should be fulfilled.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub occurrence: Option<SupplyRequestOccurrence>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub occurrence_ext: Option<SupplyRequestOccurrenceExtension>,
    /** **When the request was made**

 When the request was made.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authoredOn")]
    pub authored_on: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_authoredOn")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub authored_on_ext: Option<FieldExtension>,
    /** **Who/what is requesting service**

 The individual who initiated the request and has responsibility for its activation.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requester")]
    pub requester: Option<SupplyRequestRequester>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requester")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub requester_ext: Option<FieldExtension>,
    /** **Who is intended to fulfill the request**

 Who is intended to fulfill the request.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "supplier")]
    pub supplier: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_supplier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub supplier_ext: Vec<Option<FieldExtension>>,
    /** **Why the supply item was requested**

 Why the supply item was requested.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub reason: Option<SupplyRequestReason>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reason_ext: Option<SupplyRequestReasonExtension>,
    /** **The origin of the supply**

 Where the supply is expected to come from.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "deliverFrom")]
    pub deliver_from: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_deliverFrom")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub deliver_from_ext: Option<FieldExtension>,
    /** **The destination of the supply**

 Where the supply is destined to go.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "deliverTo")]
    pub deliver_to: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_deliverTo")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub deliver_to_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SupplyRequestBuilder {
    #[doc = concat!("Finalize building ", "SupplyRequest", ".")]
    pub fn build(self) -> Result<SupplyRequest, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<SupplyRequestInner> for SupplyRequest {
    fn from(inner: SupplyRequestInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for SupplyRequest {
    type Target = SupplyRequestInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for SupplyRequest {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl SupplyRequest {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> SupplyRequestBuilder {
        SupplyRequestBuilder::default()
    }
}
impl SupplyRequest {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::SupplyRequest
    }
}
/// Sub-fields of the orderedItem field in SupplyRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SupplyRequestOrderedItemBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SupplyRequestOrderedItem {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **The requested amount of the item indicated**

 The amount that is being ordered of the indicated item.

 */
    #[serde(rename = "quantity")]
    pub quantity: Quantity,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_quantity")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub quantity_ext: Option<FieldExtension>,
    /** **Medication, Substance, or Device requested to be supplied**

 The item that is requested to be supplied. This is either a link to a resource representing the details of the item or a code that identifies the item from a known list.

 Note that there's a difference between a prescription - an instruction to take a medication, along with a (sometimes) implicit supply, and an explicit request to supply, with no explicit instructions. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub item: Option<SupplyRequestOrderedItemItem>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub item_ext: Option<SupplyRequestOrderedItemItemExtension>,
}
#[cfg(feature = "builders")]
impl SupplyRequestOrderedItem {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SupplyRequestOrderedItemBuilder {
        SupplyRequestOrderedItemBuilder::default()
    }
}
/// Choice of types for the item[x] field in SupplyRequestOrderedItem
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SupplyRequestOrderedItemItem {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "itemCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "itemReference")]
    Reference(Reference),
}
/// Extension value for SupplyRequestOrderedItemItem.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SupplyRequestOrderedItemItemExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_itemCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_itemReference")]
    Reference(FieldExtension),
}
/// Choice of types for the occurrence[x] field in SupplyRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SupplyRequestOccurrence {
    /// Variant accepting the DateTime type.
    #[serde(rename = "occurrenceDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Period type.
    #[serde(rename = "occurrencePeriod")]
    Period(Period),
    /// Variant accepting the Timing type.
    #[serde(rename = "occurrenceTiming")]
    Timing(Timing),
}
/// Extension value for SupplyRequestOccurrence.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SupplyRequestOccurrenceExtension {
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_occurrenceDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_occurrencePeriod")]
    Period(FieldExtension),
    /// Variant accepting the Timing extension.
    #[serde(rename = "_occurrenceTiming")]
    Timing(FieldExtension),
}
/// Sub-fields of the requester field in SupplyRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "SupplyRequestRequesterBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct SupplyRequestRequester {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Individual making the request**

 The device, practitioner, etc. who initiated the request.

 */
    #[serde(rename = "agent")]
    pub agent: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_agent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub agent_ext: Option<FieldExtension>,
    /** **Organization agent is acting for**

 The organization the device or practitioner was acting on behalf of.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "onBehalfOf")]
    pub on_behalf_of: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_onBehalfOf")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub on_behalf_of_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl SupplyRequestRequester {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> SupplyRequestRequesterBuilder {
        SupplyRequestRequesterBuilder::default()
    }
}
/// Choice of types for the reason[x] field in SupplyRequest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SupplyRequestReason {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "reasonCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "reasonReference")]
    Reference(Reference),
}
/// Extension value for SupplyRequestReason.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum SupplyRequestReasonExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_reasonCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_reasonReference")]
    Reference(FieldExtension),
}
/** Base StructureDefinition for Task Resource

 **[Task](http://hl7.org/fhir/StructureDefinition/Task) v3.0.2**

 A task to be performed

 A task to be performed.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct Task(pub Box<TaskInner>);
/** Base StructureDefinition for Task Resource

 **[Task](http://hl7.org/fhir/StructureDefinition/Task) v3.0.2**

 A task to be performed

 A task to be performed.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TaskBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct TaskInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "Task::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::Task", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Task Instance Identifier**

 The business identifier for this task.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Formal definition of task**

 A reference to a formal or informal definition of the task.  For example, a protocol, a step within a defined workflow definition, etc.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub definition: Option<TaskDefinition>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub definition_ext: Option<TaskDefinitionExtension>,
    /** **Request fulfilled by this task**

 BasedOn refers to a higher-level authorization that triggered the creation of the task.  It references a "request" resource such as a ProcedureRequest, MedicationRequest, ProcedureRequest, CarePlan, etc. which is distinct from the "request" resource the task is seeking to fulfil.  This latter resource is referenced by FocusOn.  For example, based on a ProcedureRequest (= BasedOn), a task is created to fulfil a procedureRequest ( = FocusOn ) to collect a specimen from a patient.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "basedOn")]
    pub based_on: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_basedOn")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub based_on_ext: Vec<Option<FieldExtension>>,
    /** **Requisition or grouper id**

 An identifier that links together multiple tasks and other requests that were created in the same context.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "groupIdentifier")]
    pub group_identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_groupIdentifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub group_identifier_ext: Option<FieldExtension>,
    /** **Composite task**

 Task that this particular task is part of.

 This should usually be 0..1. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "partOf")]
    pub part_of: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_partOf")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub part_of_ext: Vec<Option<FieldExtension>>,
    /** **[TaskStatus](http://hl7.org/fhir/ValueSet/task-status); draft | requested | received | accepted | +**

 The current status of the task.

 */
    #[serde(rename = "status")]
    pub status: codes::TaskStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **[TaskStatusReason](); Reason for current status**

 An explanation as to why this task is held, failed, was refused, etc.

 This applies to the current status.  Look at the history of the task to see reasons for past statuses. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "statusReason")]
    pub status_reason: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_statusReason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_reason_ext: Option<FieldExtension>,
    /** **[TaskBusinessStatus](); E.g. "Specimen collected", "IV prepped"**

 Contains business-specific nuances of the business state.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "businessStatus")]
    pub business_status: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_businessStatus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub business_status_ext: Option<FieldExtension>,
    /** **[TaskIntent](http://hl7.org/fhir/ValueSet/request-intent); proposal | plan | order +**

 Indicates the "level" of actionability associated with the Task.  I.e. Is this a proposed task, a planned task, an actionable task, etc.

 This element is immutable.  Proposed tasks, planned tasks, etc. must be distinct instances.

In most cases, Tasks will have an intent of "order". */
    #[serde(rename = "intent")]
    pub intent: codes::RequestIntent,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_intent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub intent_ext: Option<FieldExtension>,
    /** **[TaskPriority](http://hl7.org/fhir/ValueSet/request-priority); normal | urgent | asap | stat**

 Indicates how quickly the Task should be addressed with respect to other requests.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "priority")]
    pub priority: Option<codes::RequestPriority>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_priority")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub priority_ext: Option<FieldExtension>,
    /** **[TaskCode](); Task Type**

 A name or code (or both) briefly describing what the task involves.

 The title (eg "My Tasks", "Outstanding Tasks for Patient X") should go into the code. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Human-readable explanation of task**

 A free-text description of what is to be performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **What task is acting on**

 The request being actioned or the resource being manipulated by this task.

 If multiple resources need to be manipulated, use sub-tasks.  (This ensures that status can be tracked independently for each referenced resource.). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "focus")]
    pub focus: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_focus")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub focus_ext: Option<FieldExtension>,
    /** **Beneficiary of the Task**

 The entity who benefits from the performance of the service specified in the task (e.g., the patient).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "for")]
    pub r#for: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_for")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#for_ext: Option<FieldExtension>,
    /** **Healthcare event during which this task originated**

 The healthcare event  (e.g. a patient and healthcare provider interaction) during which this task was created.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "context")]
    pub context: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_context")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub context_ext: Option<FieldExtension>,
    /** **Start and end time of execution**

 Identifies the time action was first taken against the task (start) and/or the time final action was taken against the task prior to marking it as completed (end).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "executionPeriod")]
    pub execution_period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_executionPeriod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub execution_period_ext: Option<FieldExtension>,
    /** **Task Creation Date**

 The date and time this task was created.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "authoredOn")]
    pub authored_on: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_authoredOn")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub authored_on_ext: Option<FieldExtension>,
    /** **Task Last Modified Date**

 The date and time of last modification to this task.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "lastModified")]
    pub last_modified: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_lastModified")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub last_modified_ext: Option<FieldExtension>,
    /** **Who is asking for task to be done**

 The creator of the task.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requester")]
    pub requester: Option<TaskRequester>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requester")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub requester_ext: Option<FieldExtension>,
    /** **[TaskPerformerType](http://hl7.org/fhir/ValueSet/task-performer-type); requester | dispatcher | scheduler | performer | monitor | manager | acquirer | reviewer**

 The type of participant that can execute the task.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "performerType")]
    pub performer_type: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_performerType")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub performer_type_ext: Vec<Option<FieldExtension>>,
    /** **Responsible individual**

 Individual organization or Device currently responsible for task execution.

 Tasks may be created with an owner not yet identified. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "owner")]
    pub owner: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_owner")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub owner_ext: Option<FieldExtension>,
    /** **[TaskReason](); Why task is needed**

 A description or code indicating why this task needs to be performed.

 This should only be included if there is no focus or if it differs from the reason indicated on the focus. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "reason")]
    pub reason: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_reason")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reason_ext: Option<FieldExtension>,
    /** **Comments made about the task**

 Free-text information captured about the task as it progresses.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
    /** **Key events in history of the Task**

 Links to Provenance records for past versions of this Task that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the task.

 This element does not point to the Provenance associated with the *current* version of the resource - as it would be created after this version existed.  The Provenance for the current version can be retrieved with a _revinclude. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "relevantHistory")]
    pub relevant_history: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_relevantHistory")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub relevant_history_ext: Vec<Option<FieldExtension>>,
    /** **Constraints on fulfillment tasks**

 If the Task.focus is a request resource and the task is seeking fulfillment (i.e is asking for the request to be actioned), this element identifies any limitations on what parts of the referenced request should be actioned.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "restriction")]
    pub restriction: Option<TaskRestriction>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_restriction")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub restriction_ext: Option<FieldExtension>,
    /** **Information used to perform task**

 Additional information that may be needed in the execution of the task.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "input")]
    pub input: Vec<Option<TaskInput>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_input")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub input_ext: Vec<Option<FieldExtension>>,
    /** **Information produced as part of task**

 Outputs produced by the Task.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "output")]
    pub output: Vec<Option<TaskOutput>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_output")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub output_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl TaskBuilder {
    #[doc = concat!("Finalize building ", "Task", ".")]
    pub fn build(self) -> Result<Task, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<TaskInner> for Task {
    fn from(inner: TaskInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for Task {
    type Target = TaskInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for Task {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl Task {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> TaskBuilder {
        TaskBuilder::default()
    }
}
impl Task {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::Task
    }
}
/// Choice of types for the definition[x] field in Task
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TaskDefinition {
    /// Variant accepting the Uri type.
    #[serde(rename = "definitionUri")]
    Uri(String),
    /// Variant accepting the Reference type.
    #[serde(rename = "definitionReference")]
    Reference(Reference),
}
/// Extension value for TaskDefinition.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TaskDefinitionExtension {
    /// Variant accepting the Uri extension.
    #[serde(rename = "_definitionUri")]
    Uri(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_definitionReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the requester field in Task
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TaskRequesterBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TaskRequester {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Individual asking for task**

 The device, practitioner, etc. who initiated the task.

 */
    #[serde(rename = "agent")]
    pub agent: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_agent")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub agent_ext: Option<FieldExtension>,
    /** **Organization individual is acting for**

 The organization the device or practitioner was acting on behalf of when they initiated the task.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "onBehalfOf")]
    pub on_behalf_of: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_onBehalfOf")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub on_behalf_of_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TaskRequester {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TaskRequesterBuilder {
        TaskRequesterBuilder::default()
    }
}
/// Sub-fields of the restriction field in Task
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TaskRestrictionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TaskRestriction {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **How many times to repeat**

 Indicates the number of times the requested action should occur.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "repetitions")]
    pub repetitions: Option<NonZeroU32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_repetitions")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub repetitions_ext: Option<FieldExtension>,
    /** **When fulfillment sought**

 Over what time-period is fulfillment sought.

 Note that period.high is the due date representing the time by which the task should be completed. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "period")]
    pub period: Option<Period>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_period")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub period_ext: Option<FieldExtension>,
    /** **For whom is fulfillment sought?**

 For requests that are targeted to more than on potential recipient/target, for whom is fulfillment sought?

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "recipient")]
    pub recipient: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_recipient")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub recipient_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl TaskRestriction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TaskRestrictionBuilder {
        TaskRestrictionBuilder::default()
    }
}
/// Sub-fields of the input field in Task
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TaskInputBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TaskInput {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[TaskInputParameterType](); Label for the input**

 A code or description indicating how the input is intended to be used as part of the task execution.

 If referencing a BPMN workflow or Protocol, the "system" is the URL for the workflow definition and the code is the "name" of the required input. */
    #[serde(rename = "type")]
    pub r#type: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Content to use in performing the task**

 The value of the input parameter as a basic type.

 */
    #[serde(flatten)]
    pub value: TaskInputValue,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<TaskInputValueExtension>,
}
#[cfg(feature = "builders")]
impl TaskInput {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TaskInputBuilder {
        TaskInputBuilder::default()
    }
}
/// Choice of types for the value[x] field in TaskInput
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TaskInputValue {
    /// Variant accepting the Base64Binary type.
    #[serde(rename = "valueBase64Binary")]
    Base64Binary(Base64Binary),
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// Variant accepting the Code type.
    #[serde(rename = "valueCode")]
    Code(String),
    /// Variant accepting the Date type.
    #[serde(rename = "valueDate")]
    Date(Date),
    /// Variant accepting the DateTime type.
    #[serde(rename = "valueDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Decimal type.
    #[serde(rename = "valueDecimal")]
    Decimal(f64),
    /// Variant accepting the Id type.
    #[serde(rename = "valueId")]
    Id(String),
    /// Variant accepting the Instant type.
    #[serde(rename = "valueInstant")]
    Instant(Instant),
    /// Variant accepting the Integer type.
    #[serde(rename = "valueInteger")]
    Integer(i32),
    /// Variant accepting the Markdown type.
    #[serde(rename = "valueMarkdown")]
    Markdown(String),
    /// Variant accepting the Oid type.
    #[serde(rename = "valueOid")]
    Oid(String),
    /// Variant accepting the PositiveInt type.
    #[serde(rename = "valuePositiveInt")]
    PositiveInt(NonZeroU32),
    /// Variant accepting the String type.
    #[serde(rename = "valueString")]
    String(String),
    /// Variant accepting the Time type.
    #[serde(rename = "valueTime")]
    Time(Time),
    /// Variant accepting the UnsignedInt type.
    #[serde(rename = "valueUnsignedInt")]
    UnsignedInt(u32),
    /// Variant accepting the Uri type.
    #[serde(rename = "valueUri")]
    Uri(String),
    /// Variant accepting the Address type.
    #[serde(rename = "valueAddress")]
    Address(Address),
    /// Variant accepting the Age type.
    #[serde(rename = "valueAge")]
    Age(Age),
    /// Variant accepting the Annotation type.
    #[serde(rename = "valueAnnotation")]
    Annotation(Annotation),
    /// Variant accepting the Attachment type.
    #[serde(rename = "valueAttachment")]
    Attachment(Attachment),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "valueCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Coding type.
    #[serde(rename = "valueCoding")]
    Coding(Coding),
    /// Variant accepting the ContactPoint type.
    #[serde(rename = "valueContactPoint")]
    ContactPoint(ContactPoint),
    /// Variant accepting the Count type.
    #[serde(rename = "valueCount")]
    Count(Count),
    /// Variant accepting the Distance type.
    #[serde(rename = "valueDistance")]
    Distance(Distance),
    /// Variant accepting the Duration type.
    #[serde(rename = "valueDuration")]
    Duration(Duration),
    /// Variant accepting the HumanName type.
    #[serde(rename = "valueHumanName")]
    HumanName(HumanName),
    /// Variant accepting the Identifier type.
    #[serde(rename = "valueIdentifier")]
    Identifier(Identifier),
    /// Variant accepting the Money type.
    #[serde(rename = "valueMoney")]
    Money(Money),
    /// Variant accepting the Period type.
    #[serde(rename = "valuePeriod")]
    Period(Period),
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Range type.
    #[serde(rename = "valueRange")]
    Range(Range),
    /// Variant accepting the Ratio type.
    #[serde(rename = "valueRatio")]
    Ratio(Ratio),
    /// Variant accepting the Reference type.
    #[serde(rename = "valueReference")]
    Reference(Reference),
    /// Variant accepting the SampledData type.
    #[serde(rename = "valueSampledData")]
    SampledData(SampledData),
    /// Variant accepting the Signature type.
    #[serde(rename = "valueSignature")]
    Signature(Signature),
    /// Variant accepting the Timing type.
    #[serde(rename = "valueTiming")]
    Timing(Timing),
    /// Variant accepting the Meta type.
    #[serde(rename = "valueMeta")]
    Meta(Meta),
}
/// Extension value for TaskInputValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TaskInputValueExtension {
    /// Variant accepting the Base64Binary extension.
    #[serde(rename = "_valueBase64Binary")]
    Base64Binary(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Code extension.
    #[serde(rename = "_valueCode")]
    Code(FieldExtension),
    /// Variant accepting the Date extension.
    #[serde(rename = "_valueDate")]
    Date(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_valueDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Decimal extension.
    #[serde(rename = "_valueDecimal")]
    Decimal(FieldExtension),
    /// Variant accepting the Id extension.
    #[serde(rename = "_valueId")]
    Id(FieldExtension),
    /// Variant accepting the Instant extension.
    #[serde(rename = "_valueInstant")]
    Instant(FieldExtension),
    /// Variant accepting the Integer extension.
    #[serde(rename = "_valueInteger")]
    Integer(FieldExtension),
    /// Variant accepting the Markdown extension.
    #[serde(rename = "_valueMarkdown")]
    Markdown(FieldExtension),
    /// Variant accepting the Oid extension.
    #[serde(rename = "_valueOid")]
    Oid(FieldExtension),
    /// Variant accepting the PositiveInt extension.
    #[serde(rename = "_valuePositiveInt")]
    PositiveInt(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_valueString")]
    String(FieldExtension),
    /// Variant accepting the Time extension.
    #[serde(rename = "_valueTime")]
    Time(FieldExtension),
    /// Variant accepting the UnsignedInt extension.
    #[serde(rename = "_valueUnsignedInt")]
    UnsignedInt(FieldExtension),
    /// Variant accepting the Uri extension.
    #[serde(rename = "_valueUri")]
    Uri(FieldExtension),
    /// Variant accepting the Address extension.
    #[serde(rename = "_valueAddress")]
    Address(FieldExtension),
    /// Variant accepting the Age extension.
    #[serde(rename = "_valueAge")]
    Age(FieldExtension),
    /// Variant accepting the Annotation extension.
    #[serde(rename = "_valueAnnotation")]
    Annotation(FieldExtension),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_valueAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_valueCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_valueCoding")]
    Coding(FieldExtension),
    /// Variant accepting the ContactPoint extension.
    #[serde(rename = "_valueContactPoint")]
    ContactPoint(FieldExtension),
    /// Variant accepting the Count extension.
    #[serde(rename = "_valueCount")]
    Count(FieldExtension),
    /// Variant accepting the Distance extension.
    #[serde(rename = "_valueDistance")]
    Distance(FieldExtension),
    /// Variant accepting the Duration extension.
    #[serde(rename = "_valueDuration")]
    Duration(FieldExtension),
    /// Variant accepting the HumanName extension.
    #[serde(rename = "_valueHumanName")]
    HumanName(FieldExtension),
    /// Variant accepting the Identifier extension.
    #[serde(rename = "_valueIdentifier")]
    Identifier(FieldExtension),
    /// Variant accepting the Money extension.
    #[serde(rename = "_valueMoney")]
    Money(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_valuePeriod")]
    Period(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_valueRange")]
    Range(FieldExtension),
    /// Variant accepting the Ratio extension.
    #[serde(rename = "_valueRatio")]
    Ratio(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_valueReference")]
    Reference(FieldExtension),
    /// Variant accepting the SampledData extension.
    #[serde(rename = "_valueSampledData")]
    SampledData(FieldExtension),
    /// Variant accepting the Signature extension.
    #[serde(rename = "_valueSignature")]
    Signature(FieldExtension),
    /// Variant accepting the Timing extension.
    #[serde(rename = "_valueTiming")]
    Timing(FieldExtension),
    /// Variant accepting the Meta extension.
    #[serde(rename = "_valueMeta")]
    Meta(FieldExtension),
}
/// Sub-fields of the output field in Task
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TaskOutputBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TaskOutput {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[TaskOutputParameterType](); Label for output**

 The name of the Output parameter.

 */
    #[serde(rename = "type")]
    pub r#type: CodeableConcept,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **Result of output**

 The value of the Output parameter as a basic type.

 */
    #[serde(flatten)]
    pub value: TaskOutputValue,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<TaskOutputValueExtension>,
}
#[cfg(feature = "builders")]
impl TaskOutput {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TaskOutputBuilder {
        TaskOutputBuilder::default()
    }
}
/// Choice of types for the value[x] field in TaskOutput
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TaskOutputValue {
    /// Variant accepting the Base64Binary type.
    #[serde(rename = "valueBase64Binary")]
    Base64Binary(Base64Binary),
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// Variant accepting the Code type.
    #[serde(rename = "valueCode")]
    Code(String),
    /// Variant accepting the Date type.
    #[serde(rename = "valueDate")]
    Date(Date),
    /// Variant accepting the DateTime type.
    #[serde(rename = "valueDateTime")]
    DateTime(DateTime),
    /// Variant accepting the Decimal type.
    #[serde(rename = "valueDecimal")]
    Decimal(f64),
    /// Variant accepting the Id type.
    #[serde(rename = "valueId")]
    Id(String),
    /// Variant accepting the Instant type.
    #[serde(rename = "valueInstant")]
    Instant(Instant),
    /// Variant accepting the Integer type.
    #[serde(rename = "valueInteger")]
    Integer(i32),
    /// Variant accepting the Markdown type.
    #[serde(rename = "valueMarkdown")]
    Markdown(String),
    /// Variant accepting the Oid type.
    #[serde(rename = "valueOid")]
    Oid(String),
    /// Variant accepting the PositiveInt type.
    #[serde(rename = "valuePositiveInt")]
    PositiveInt(NonZeroU32),
    /// Variant accepting the String type.
    #[serde(rename = "valueString")]
    String(String),
    /// Variant accepting the Time type.
    #[serde(rename = "valueTime")]
    Time(Time),
    /// Variant accepting the UnsignedInt type.
    #[serde(rename = "valueUnsignedInt")]
    UnsignedInt(u32),
    /// Variant accepting the Uri type.
    #[serde(rename = "valueUri")]
    Uri(String),
    /// Variant accepting the Address type.
    #[serde(rename = "valueAddress")]
    Address(Address),
    /// Variant accepting the Age type.
    #[serde(rename = "valueAge")]
    Age(Age),
    /// Variant accepting the Annotation type.
    #[serde(rename = "valueAnnotation")]
    Annotation(Annotation),
    /// Variant accepting the Attachment type.
    #[serde(rename = "valueAttachment")]
    Attachment(Attachment),
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "valueCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Coding type.
    #[serde(rename = "valueCoding")]
    Coding(Coding),
    /// Variant accepting the ContactPoint type.
    #[serde(rename = "valueContactPoint")]
    ContactPoint(ContactPoint),
    /// Variant accepting the Count type.
    #[serde(rename = "valueCount")]
    Count(Count),
    /// Variant accepting the Distance type.
    #[serde(rename = "valueDistance")]
    Distance(Distance),
    /// Variant accepting the Duration type.
    #[serde(rename = "valueDuration")]
    Duration(Duration),
    /// Variant accepting the HumanName type.
    #[serde(rename = "valueHumanName")]
    HumanName(HumanName),
    /// Variant accepting the Identifier type.
    #[serde(rename = "valueIdentifier")]
    Identifier(Identifier),
    /// Variant accepting the Money type.
    #[serde(rename = "valueMoney")]
    Money(Money),
    /// Variant accepting the Period type.
    #[serde(rename = "valuePeriod")]
    Period(Period),
    /// Variant accepting the Quantity type.
    #[serde(rename = "valueQuantity")]
    Quantity(Quantity),
    /// Variant accepting the Range type.
    #[serde(rename = "valueRange")]
    Range(Range),
    /// Variant accepting the Ratio type.
    #[serde(rename = "valueRatio")]
    Ratio(Ratio),
    /// Variant accepting the Reference type.
    #[serde(rename = "valueReference")]
    Reference(Reference),
    /// Variant accepting the SampledData type.
    #[serde(rename = "valueSampledData")]
    SampledData(SampledData),
    /// Variant accepting the Signature type.
    #[serde(rename = "valueSignature")]
    Signature(Signature),
    /// Variant accepting the Timing type.
    #[serde(rename = "valueTiming")]
    Timing(Timing),
    /// Variant accepting the Meta type.
    #[serde(rename = "valueMeta")]
    Meta(Meta),
}
/// Extension value for TaskOutputValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum TaskOutputValueExtension {
    /// Variant accepting the Base64Binary extension.
    #[serde(rename = "_valueBase64Binary")]
    Base64Binary(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Code extension.
    #[serde(rename = "_valueCode")]
    Code(FieldExtension),
    /// Variant accepting the Date extension.
    #[serde(rename = "_valueDate")]
    Date(FieldExtension),
    /// Variant accepting the DateTime extension.
    #[serde(rename = "_valueDateTime")]
    DateTime(FieldExtension),
    /// Variant accepting the Decimal extension.
    #[serde(rename = "_valueDecimal")]
    Decimal(FieldExtension),
    /// Variant accepting the Id extension.
    #[serde(rename = "_valueId")]
    Id(FieldExtension),
    /// Variant accepting the Instant extension.
    #[serde(rename = "_valueInstant")]
    Instant(FieldExtension),
    /// Variant accepting the Integer extension.
    #[serde(rename = "_valueInteger")]
    Integer(FieldExtension),
    /// Variant accepting the Markdown extension.
    #[serde(rename = "_valueMarkdown")]
    Markdown(FieldExtension),
    /// Variant accepting the Oid extension.
    #[serde(rename = "_valueOid")]
    Oid(FieldExtension),
    /// Variant accepting the PositiveInt extension.
    #[serde(rename = "_valuePositiveInt")]
    PositiveInt(FieldExtension),
    /// Variant accepting the String extension.
    #[serde(rename = "_valueString")]
    String(FieldExtension),
    /// Variant accepting the Time extension.
    #[serde(rename = "_valueTime")]
    Time(FieldExtension),
    /// Variant accepting the UnsignedInt extension.
    #[serde(rename = "_valueUnsignedInt")]
    UnsignedInt(FieldExtension),
    /// Variant accepting the Uri extension.
    #[serde(rename = "_valueUri")]
    Uri(FieldExtension),
    /// Variant accepting the Address extension.
    #[serde(rename = "_valueAddress")]
    Address(FieldExtension),
    /// Variant accepting the Age extension.
    #[serde(rename = "_valueAge")]
    Age(FieldExtension),
    /// Variant accepting the Annotation extension.
    #[serde(rename = "_valueAnnotation")]
    Annotation(FieldExtension),
    /// Variant accepting the Attachment extension.
    #[serde(rename = "_valueAttachment")]
    Attachment(FieldExtension),
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_valueCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Coding extension.
    #[serde(rename = "_valueCoding")]
    Coding(FieldExtension),
    /// Variant accepting the ContactPoint extension.
    #[serde(rename = "_valueContactPoint")]
    ContactPoint(FieldExtension),
    /// Variant accepting the Count extension.
    #[serde(rename = "_valueCount")]
    Count(FieldExtension),
    /// Variant accepting the Distance extension.
    #[serde(rename = "_valueDistance")]
    Distance(FieldExtension),
    /// Variant accepting the Duration extension.
    #[serde(rename = "_valueDuration")]
    Duration(FieldExtension),
    /// Variant accepting the HumanName extension.
    #[serde(rename = "_valueHumanName")]
    HumanName(FieldExtension),
    /// Variant accepting the Identifier extension.
    #[serde(rename = "_valueIdentifier")]
    Identifier(FieldExtension),
    /// Variant accepting the Money extension.
    #[serde(rename = "_valueMoney")]
    Money(FieldExtension),
    /// Variant accepting the Period extension.
    #[serde(rename = "_valuePeriod")]
    Period(FieldExtension),
    /// Variant accepting the Quantity extension.
    #[serde(rename = "_valueQuantity")]
    Quantity(FieldExtension),
    /// Variant accepting the Range extension.
    #[serde(rename = "_valueRange")]
    Range(FieldExtension),
    /// Variant accepting the Ratio extension.
    #[serde(rename = "_valueRatio")]
    Ratio(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_valueReference")]
    Reference(FieldExtension),
    /// Variant accepting the SampledData extension.
    #[serde(rename = "_valueSampledData")]
    SampledData(FieldExtension),
    /// Variant accepting the Signature extension.
    #[serde(rename = "_valueSignature")]
    Signature(FieldExtension),
    /// Variant accepting the Timing extension.
    #[serde(rename = "_valueTiming")]
    Timing(FieldExtension),
    /// Variant accepting the Meta extension.
    #[serde(rename = "_valueMeta")]
    Meta(FieldExtension),
}
/** Base StructureDefinition for TestReport Resource

 **[TestReport](http://hl7.org/fhir/StructureDefinition/TestReport) v3.0.2**

 Describes the results of a TestScript execution

 A summary of information based on the results of executing a TestScript.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct TestReport(pub Box<TestReportInner>);
/** Base StructureDefinition for TestReport Resource

 **[TestReport](http://hl7.org/fhir/StructureDefinition/TestReport) v3.0.2**

 Describes the results of a TestScript execution

 A summary of information based on the results of executing a TestScript.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestReportBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct TestReportInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "TestReport::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::TestReport", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **External identifier**

 Identifier for the TestScript assigned for external purposes outside the context of FHIR.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **Informal name of the executed TestScript**

 A free text natural language name identifying the executed TestScript.

 Not expected to be globally unique. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **[TestReportStatus](http://hl7.org/fhir/ValueSet/report-status-codes); completed | in-progress | waiting | stopped | entered-in-error**

 The current state of this test report.

 The status represents where the execution is currently within the test script execution life cycle.

This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid. */
    #[serde(rename = "status")]
    pub status: codes::TestReportStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **Reference to the  version-specific TestScript that was executed to produce this TestReport**

 Ideally this is an absolute URL that is used to identify the version-specific TestScript that was executed, matching the `TestScript.url`.

 */
    #[serde(rename = "testScript")]
    pub test_script: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_testScript")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub test_script_ext: Option<FieldExtension>,
    /** **[TestReportResult](http://hl7.org/fhir/ValueSet/report-result-codes); pass | fail | pending**

 The overall result from the execution of the TestScript.

 The pass and fail result represents a completed test script execution. The pending result represents a test script execution that has not yet started or is currently in progress. */
    #[serde(rename = "result")]
    pub result: codes::TestReportResult,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_result")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub result_ext: Option<FieldExtension>,
    /** **The final score (percentage of tests passed) resulting from the execution of the TestScript**

 The final score (percentage of tests passed) resulting from the execution of the TestScript.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "score")]
    pub score: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_score")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub score_ext: Option<FieldExtension>,
    /** **Name of the tester producing this report (Organization or individual)**

 Name of the tester producing this report (Organization or individual).

 Usually an organization, but may be an individual. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "tester")]
    pub tester: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_tester")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub tester_ext: Option<FieldExtension>,
    /** **When the TestScript was executed and this TestReport was generated**

 When the TestScript was executed and this TestReport was generated.

 Additional specific dates may be added as extensions. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "issued")]
    pub issued: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_issued")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub issued_ext: Option<FieldExtension>,
    /** **A participant in the test execution, either the execution engine, a client, or a server**

 A participant in the test execution, either the execution engine, a client, or a server.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "participant")]
    pub participant: Vec<Option<TestReportParticipant>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_participant")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub participant_ext: Vec<Option<FieldExtension>>,
    /** **The results of the series of required setup operations before the tests were executed**

 The results of the series of required setup operations before the tests were executed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "setup")]
    pub setup: Option<TestReportSetup>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_setup")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub setup_ext: Option<FieldExtension>,
    /** **A test executed from the test script**

 A test executed from the test script.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "test")]
    pub test: Vec<Option<TestReportTest>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_test")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub test_ext: Vec<Option<FieldExtension>>,
    /** **The results of running the series of required clean up steps**

 The results of the series of operations required to clean up after the all the tests were executed (successfully or otherwise).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "teardown")]
    pub teardown: Option<TestReportTeardown>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_teardown")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub teardown_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestReportBuilder {
    #[doc = concat!("Finalize building ", "TestReport", ".")]
    pub fn build(self) -> Result<TestReport, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<TestReportInner> for TestReport {
    fn from(inner: TestReportInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for TestReport {
    type Target = TestReportInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for TestReport {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TestReport {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> TestReportBuilder {
        TestReportBuilder::default()
    }
}
impl TestReport {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::TestReport
    }
}
/// Sub-fields of the participant field in TestReport
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestReportParticipantBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestReportParticipant {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[TestReportParticipantType](http://hl7.org/fhir/ValueSet/report-participant-type); test-engine | client | server**

 The type of participant.

 */
    #[serde(rename = "type")]
    pub r#type: codes::TestReportParticipantType,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **The uri of the participant. An absolute URL is preferred**

 The uri of the participant. An absolute URL is preferred.

 */
    #[serde(rename = "uri")]
    pub uri: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_uri")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub uri_ext: Option<FieldExtension>,
    /** **The display name of the participant**

 The display name of the participant.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "display")]
    pub display: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_display")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub display_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestReportParticipant {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestReportParticipantBuilder {
        TestReportParticipantBuilder::default()
    }
}
/// Sub-fields of the setup field in TestReport
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestReportSetupBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestReportSetup {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **A setup operation or assert that was executed**

 Action would contain either an operation or an assertion.

 An action should contain either an operation or an assertion but not both.  It can contain any number of variables. */
    #[serde(rename = "action")]
    pub action: Vec<Option<TestReportSetupAction>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_action")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub action_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl TestReportSetup {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestReportSetupBuilder {
        TestReportSetupBuilder::default()
    }
}
/// Sub-fields of the action field in TestReportSetup
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestReportSetupActionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestReportSetupAction {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **The operation to perform**

 The operation performed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "operation")]
    pub operation: Option<TestReportSetupActionOperation>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_operation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub operation_ext: Option<FieldExtension>,
    /** **The assertion to perform**

 The results of the assertion performed on the previous operations.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "assert")]
    pub assert: Option<TestReportSetupActionAssert>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_assert")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub assert_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestReportSetupAction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestReportSetupActionBuilder {
        TestReportSetupActionBuilder::default()
    }
}
/// Sub-fields of the operation field in TestReportSetupAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestReportSetupActionOperationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestReportSetupActionOperation {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[TestReportActionResult](http://hl7.org/fhir/ValueSet/report-action-result-codes); pass | skip | fail | warning | error**

 The result of this operation.

 */
    #[serde(rename = "result")]
    pub result: codes::TestReportActionResult,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_result")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub result_ext: Option<FieldExtension>,
    /** **A message associated with the result**

 An explanatory message associated with the result.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "message")]
    pub message: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_message")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub message_ext: Option<FieldExtension>,
    /** **A link to further details on the result**

 A link to further details on the result.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "detail")]
    pub detail: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_detail")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub detail_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestReportSetupActionOperation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestReportSetupActionOperationBuilder {
        TestReportSetupActionOperationBuilder::default()
    }
}
/// Sub-fields of the assert field in TestReportSetupAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestReportSetupActionAssertBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestReportSetupActionAssert {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[TestReportActionResult](http://hl7.org/fhir/ValueSet/report-action-result-codes); pass | skip | fail | warning | error**

 The result of this assertion.

 */
    #[serde(rename = "result")]
    pub result: codes::TestReportActionResult,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_result")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub result_ext: Option<FieldExtension>,
    /** **A message associated with the result**

 An explanatory message associated with the result.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "message")]
    pub message: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_message")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub message_ext: Option<FieldExtension>,
    /** **A link to further details on the result**

 A link to further details on the result.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "detail")]
    pub detail: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_detail")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub detail_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestReportSetupActionAssert {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestReportSetupActionAssertBuilder {
        TestReportSetupActionAssertBuilder::default()
    }
}
/// Sub-fields of the test field in TestReport
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestReportTestBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestReportTest {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Tracking/logging name of this test**

 The name of this test used for tracking/logging purposes by test engines.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Tracking/reporting short description of the test**

 A short description of the test used by test engines for tracking and reporting purposes.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **A test operation or assert that was performed**

 Action would contain either an operation or an assertion.

 An action should contain either an operation or an assertion but not both.  It can contain any number of variables. */
    #[serde(rename = "action")]
    pub action: Vec<Option<TestReportTestAction>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_action")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub action_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl TestReportTest {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestReportTestBuilder {
        TestReportTestBuilder::default()
    }
}
/// Sub-fields of the action field in TestReportTest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestReportTestActionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestReportTestAction {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **The operation performed**

 An operation would involve a REST request to a server.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "operation")]
    pub operation: Option<TestReportSetupActionOperation>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_operation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub operation_ext: Option<FieldExtension>,
    /** **The assertion performed**

 The results of the assertion performed on the previous operations.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "assert")]
    pub assert: Option<TestReportSetupActionAssert>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_assert")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub assert_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestReportTestAction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestReportTestActionBuilder {
        TestReportTestActionBuilder::default()
    }
}
/// Sub-fields of the teardown field in TestReport
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestReportTeardownBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestReportTeardown {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **One or more teardown operations performed**

 The teardown action will only contain an operation.

 An action should contain either an operation or an assertion but not both.  It can contain any number of variables. */
    #[serde(rename = "action")]
    pub action: Vec<Option<TestReportTeardownAction>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_action")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub action_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl TestReportTeardown {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestReportTeardownBuilder {
        TestReportTeardownBuilder::default()
    }
}
/// Sub-fields of the action field in TestReportTeardown
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestReportTeardownActionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestReportTeardownAction {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **The teardown operation performed**

 An operation would involve a REST request to a server.

 */
    #[serde(rename = "operation")]
    pub operation: TestReportSetupActionOperation,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_operation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub operation_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestReportTeardownAction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestReportTeardownActionBuilder {
        TestReportTeardownActionBuilder::default()
    }
}
/** Base StructureDefinition for TestScript Resource

 **[TestScript](http://hl7.org/fhir/StructureDefinition/TestScript) v3.0.2**

 Describes a set of tests

 A structured set of tests against a FHIR server implementation to determine compliance against the FHIR specification.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct TestScript(pub Box<TestScriptInner>);
/** Base StructureDefinition for TestScript Resource

 **[TestScript](http://hl7.org/fhir/StructureDefinition/TestScript) v3.0.2**

 Describes a set of tests

 A structured set of tests against a FHIR server implementation to determine compliance against the FHIR specification.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct TestScriptInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "TestScript::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::TestScript", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical URI to reference this test script (globally unique)**

 An absolute URI that is used to identify this test script when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this test script is (or will be) published. The URL SHOULD include the major version of the test script. For more information see [Technical and Business Versions](resource.html#versions).

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred.  Multiple instances may share the same url if they have a distinct version. */
    #[serde(rename = "url")]
    pub url: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Additional identifier for the test script**

 A formal identifier that is used to identify this test script when it is represented in other formats, or referenced in a specification, model, design or an instance.

 Typically, this is used for identifiers that can go in an HL7 V3 II (instance identifier) data type, e.g., to identify this test script outside of FHIR, where it is not possible to use the logical URI. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Option<Identifier>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **Business version of the test script**

 The identifier that is used to identify this version of the test script when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the test script author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.

 There may be different test script instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a refrence to a particular business version of the test script with the format [url]|[version]. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Name for this test script (computer friendly)**

 A natural language name identifying the test script. This name should be usable as an identifier for the module by machine processing applications such as code generation.

 The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure that it is computable friendly. */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Name for this test script (human friendly)**

 A short, descriptive, user-friendly title for the test script.

 This name does not need to be machine-processing friendly and may contain punctuation, white-space, etc. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this test script. Enables tracking the life-cycle of the content.

 Allows filtering of test scripts that are appropriate for use vs. not.
This is labeled as "Is Modifier" because applications should not use a retired test script without due consideration. */
    #[serde(rename = "status")]
    pub status: codes::PublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **For testing purposes, not real usage**

 A boolean value to indicate that this test script is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of test script that are appropriate for use vs. not. This is labeled as "Is Modifier" because applications should not use an experimental test script in production. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "experimental")]
    pub experimental: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_experimental")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub experimental_ext: Option<FieldExtension>,
    /** **Date this was last changed**

 The date  (and optionally time) when the test script was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the test script changes.

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the test script. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Name of the publisher (organization or individual)**

 The name of the individual or organization that published the test script.

 Usually an organization, but may be an individual. The publisher (or steward) of the test script is the organization or individual primarily responsible for the maintenance and upkeep of the test script. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the test script. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisher")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_ext: Option<FieldExtension>,
    /** **Contact details for the publisher**

 Contact details to assist a user in finding and communicating with the publisher.

 May be a web site, an email address, a telephone number, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Natural language description of the test script**

 A free text natural language description of the test script from a consumer's perspective.

 This description can be used to capture details such as why the test script was built, comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the test script as conveyed in the 'text' field of the resource itself. This item SHOULD be populated unless the information is available from context (e.g. the language of the profile is presumed to be the predominant language in the place the profile was created). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Context the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate test script instances.

 When multiple useContexts are specified, there is no expectation whether all or any of the contexts apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useContext")]
    pub use_context: Vec<Option<UsageContext>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_useContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_context_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Intended jurisdiction for test script (if applicable)**

 A legal or geographic region in which the test script is intended to be used.

 It may be possible for the test script to be used in jurisdictions other than those for which it was originally designed or intended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **Why this test script is defined**

 Explaination of why this test script is needed and why it has been designed as it has.

 This element does not describe the usage of the test script Instead  it provides traceability of ''why'' the resource is either needed or ''why'' it is defined as it is.  This may be used to point to source materials or specifications that drove the structure of this test script. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purpose")]
    pub purpose: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_purpose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub purpose_ext: Option<FieldExtension>,
    /** **Use and/or publishing restrictions**

 A copyright statement relating to the test script and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the test script.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyright")]
    pub copyright: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyright")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_ext: Option<FieldExtension>,
    /** **An abstract server representing a client or sender in a message exchange**

 An abstract server used in operations within this test script in the origin element.

 The purpose of this element is to define the profile of an origin element used elsewhere in the script.  Test engines could then use the origin-profile mapping to offer a filtered list of test systems that can serve as the sender for the interaction. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "origin")]
    pub origin: Vec<Option<TestScriptOrigin>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_origin")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub origin_ext: Vec<Option<FieldExtension>>,
    /** **An abstract server representing a destination or receiver in a message exchange**

 An abstract server used in operations within this test script in the destination element.

 The purpose of this element is to define the profile of a destination element used elsewhere in the script.  Test engines could then use the destination-profile mapping to offer a filtered list of test systems that can serve as the receiver for the interaction. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "destination")]
    pub destination: Vec<Option<TestScriptDestination>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_destination")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub destination_ext: Vec<Option<FieldExtension>>,
    /** **Required capability that is assumed to function correctly on the FHIR server being tested**

 The required capability must exist and are assumed to function correctly on the FHIR server being tested.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "metadata")]
    pub metadata: Option<TestScriptMetadata>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_metadata")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub metadata_ext: Option<FieldExtension>,
    /** **Fixture in the test script - by reference (uri)**

 Fixture in the test script - by reference (uri). All fixtures are required for the test script to execute.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "fixture")]
    pub fixture: Vec<Option<TestScriptFixture>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_fixture")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub fixture_ext: Vec<Option<FieldExtension>>,
    /** **Reference of the validation profile**

 Reference to the profile to be used for validation.

 See http://hl7.org/fhir/STU3/resourcelist.html for complete list of resource types. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "profile")]
    pub profile: Vec<Option<Reference>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_profile")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub profile_ext: Vec<Option<FieldExtension>>,
    /** **Placeholder for evaluated elements**

 Variable is set based either on element value in response body or on header field value in the response headers.

 Variables would be set based either on XPath/JSONPath expressions against fixtures (static and response), or headerField evaluations against response headers. If variable evaluates to nodelist or anything other than a primitive value, then test engine would report an error.  Variables would be used to perform clean replacements in "operation.params", "operation.requestHeader.value", and "operation.url" element values during operation calls and in "assert.value" during assertion evaluations. This limits the places that test engines would need to look for placeholders "${}".  Variables are scoped to the whole script. They are NOT evaluated at declaration. They are evaluated by test engine when used for substitutions in "operation.params", "operation.requestHeader.value", and "operation.url" element values during operation calls and in "assert.value" during assertion evaluations.  See example testscript-search.xml. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "variable")]
    pub variable: Vec<Option<TestScriptVariable>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_variable")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub variable_ext: Vec<Option<FieldExtension>>,
    /** **Assert rule used within the test script**

 Assert rule to be used in one or more asserts within the test script.

 Each rule should be treated by test engines as one assertion regardless of how many assertions are contained within the external rule template.  The impact of negative rule evaluation on test script execution is the same as an assertion failure which is described elsewhere in the TestScript resource. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "rule")]
    pub rule: Vec<Option<TestScriptRule>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_rule")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub rule_ext: Vec<Option<FieldExtension>>,
    /** **Assert ruleset used within the test script**

 Contains one or more rules.  Offers a way to group rules so assertions could reference the group of rules and have them all applied.

 Each rule within a ruleset should be treated by test engines as one assertion regardless of how many assertions are contained within the external rule template.  The impact of negative rule evaluation on test script execution is the same as an assertion failure which is described elsewhere in the TestScript resource. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "ruleset")]
    pub ruleset: Vec<Option<TestScriptRuleset>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_ruleset")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub ruleset_ext: Vec<Option<FieldExtension>>,
    /** **A series of required setup operations before tests are executed**

 A series of required setup operations before tests are executed.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "setup")]
    pub setup: Option<TestScriptSetup>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_setup")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub setup_ext: Option<FieldExtension>,
    /** **A test in this script**

 A test in this script.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "test")]
    pub test: Vec<Option<TestScriptTest>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_test")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub test_ext: Vec<Option<FieldExtension>>,
    /** **A series of required clean up steps**

 A series of operations required to clean up after the all the tests are executed (successfully or otherwise).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "teardown")]
    pub teardown: Option<TestScriptTeardown>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_teardown")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub teardown_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestScriptBuilder {
    #[doc = concat!("Finalize building ", "TestScript", ".")]
    pub fn build(self) -> Result<TestScript, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<TestScriptInner> for TestScript {
    fn from(inner: TestScriptInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for TestScript {
    type Target = TestScriptInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for TestScript {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl TestScript {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> TestScriptBuilder {
        TestScriptBuilder::default()
    }
}
impl TestScript {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::TestScript
    }
}
/// Sub-fields of the origin field in TestScript
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptOriginBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptOrigin {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **The index of the abstract origin server starting at 1**

 Abstract name given to an origin server in this test script.  The name is provided as a number starting at 1.

 A given origin index (e.g. 1) can appear only once in the list (e.g. Origin 1 cannot be specified twice ... once as FormFiller and and again as FormProcessor within the same script as that could get confusing during test configuration).

Different origin indices could play the same actor in the same test script (e.g. You could have two different test systems acting as Form-Filler).

The origin indices provided elsewhere in the test script must be one of these origin indices. */
    #[serde(rename = "index")]
    pub index: i32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_index")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub index_ext: Option<FieldExtension>,
    /** **[TestScriptProfileOriginType](http://hl7.org/fhir/ValueSet/testscript-profile-origin-types); FHIR-Client | FHIR-SDC-FormFiller**

 The type of origin profile the test system supports.

 Must be a "sender"/"client" profile. */
    #[serde(rename = "profile")]
    pub profile: Coding,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_profile")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub profile_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestScriptOrigin {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptOriginBuilder {
        TestScriptOriginBuilder::default()
    }
}
/// Sub-fields of the destination field in TestScript
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptDestinationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptDestination {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **The index of the abstract destination server starting at 1**

 Abstract name given to a destination server in this test script.  The name is provided as a number starting at 1.

 A given destination index (e.g. 1) can appear only once in the list (e.g. Destination 1 cannot be specified twice ... once as Form-Manager and again as Form-Processor within the same script as that could get confusing during test configuration).

Different destination indices could play the same actor in the same test script (e.g. You could have two different test systems acting as Form-Manager).

The destination indices provided elsewhere in the test script must be one of these destination indices. */
    #[serde(rename = "index")]
    pub index: i32,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_index")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub index_ext: Option<FieldExtension>,
    /** **[TestScriptProfileDestinationType](http://hl7.org/fhir/ValueSet/testscript-profile-destination-types); FHIR-Server | FHIR-SDC-FormManager | FHIR-SDC-FormReceiver | FHIR-SDC-FormProcessor**

 The type of destination profile the test system supports.

 Must be a "receiver"/"server" profile. */
    #[serde(rename = "profile")]
    pub profile: Coding,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_profile")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub profile_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestScriptDestination {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptDestinationBuilder {
        TestScriptDestinationBuilder::default()
    }
}
/// Sub-fields of the metadata field in TestScript
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptMetadataBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptMetadata {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Links to the FHIR specification**

 A link to the FHIR specification that this test is covering.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "link")]
    pub link: Vec<Option<TestScriptMetadataLink>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_link")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub link_ext: Vec<Option<FieldExtension>>,
    /** **Capabilities  that are assumed to function correctly on the FHIR server being tested**

 Capabilities that must exist and are assumed to function correctly on the FHIR server being tested.

 When the metadata capabilities section is defined at TestScript.metadata or at TestScript.setup.metadata, and the server's conformance statement does not contain the elements defined in the minimal conformance statement, then all the tests in the TestScript are skipped.  When the metadata capabilities section is defined at TestScript.test.metadata and the server's conformance statement does not contain the elements defined in the minimal conformance statement, then only that test is skipped.  The "metadata.capabilities.required" and "metadata.capabilities.validated" elements only indicate whether the capabilities are the primary focus of the test script or not.  They do not impact the skipping logic.  Capabilities whose "metadata.capabilities.validated" flag is true are the primary focus of the test script. */
    #[serde(rename = "capability")]
    pub capability: Vec<Option<TestScriptMetadataCapability>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_capability")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub capability_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl TestScriptMetadata {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptMetadataBuilder {
        TestScriptMetadataBuilder::default()
    }
}
/// Sub-fields of the link field in TestScriptMetadata
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptMetadataLinkBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptMetadataLink {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **URL to the specification**

 URL to a particular requirement or feature within the FHIR specification.

 */
    #[serde(rename = "url")]
    pub url: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Short description**

 Short description of the link.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestScriptMetadataLink {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptMetadataLinkBuilder {
        TestScriptMetadataLinkBuilder::default()
    }
}
/// Sub-fields of the capability field in TestScriptMetadata
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptMetadataCapabilityBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptMetadataCapability {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Are the capabilities required?**

 Whether or not the test execution will require the given capabilities of the server in order for this test script to execute.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "required")]
    pub required: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_required")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub required_ext: Option<FieldExtension>,
    /** **Are the capabilities validated?**

 Whether or not the test execution will validate the given capabilities of the server in order for this test script to execute.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "validated")]
    pub validated: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_validated")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub validated_ext: Option<FieldExtension>,
    /** **The expected capabilities of the server**

 Description of the capabilities that this test script is requiring the server to support.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Which origin server these requirements apply to**

 Which origin server these requirements apply to.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "origin")]
    pub origin: Vec<Option<i32>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_origin")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub origin_ext: Vec<Option<FieldExtension>>,
    /** **Which server these requirements apply to**

 Which server these requirements apply to.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "destination")]
    pub destination: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_destination")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub destination_ext: Option<FieldExtension>,
    /** **Links to the FHIR specification**

 Links to the FHIR specification that describes this interaction and the resources involved in more detail.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "link")]
    pub link: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_link")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub link_ext: Vec<Option<FieldExtension>>,
    /** **Required Capability Statement**

 Minimum capabilities required of server for test script to execute successfully.   If server does not meet at a minimum the referenced capability statement, then all tests in this script are skipped.

 The conformance statement of the server has to contain at a minimum the contents of the reference pointed to by this element. */
    #[serde(rename = "capabilities")]
    pub capabilities: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_capabilities")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub capabilities_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestScriptMetadataCapability {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptMetadataCapabilityBuilder {
        TestScriptMetadataCapabilityBuilder::default()
    }
}
/// Sub-fields of the fixture field in TestScript
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptFixtureBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptFixture {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Whether or not to implicitly create the fixture during setup**

 Whether or not to implicitly create the fixture during setup. If true, the fixture is automatically created on each server being tested during setup, therefore no create operation is required for this fixture in the TestScript.setup section.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "autocreate")]
    pub autocreate: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_autocreate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub autocreate_ext: Option<FieldExtension>,
    /** **Whether or not to implicitly delete the fixture during teardown**

 Whether or not to implicitly delete the fixture during teardown. If true, the fixture is automatically deleted on each server being tested during teardown, therefore no delete operation is required for this fixture in the TestScript.teardown section.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "autodelete")]
    pub autodelete: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_autodelete")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub autodelete_ext: Option<FieldExtension>,
    /** **Reference of the resource**

 Reference to the resource (containing the contents of the resource needed for operations).

 See http://hl7.org/fhir/STU3/resourcelist.html for complete list of resource types. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "resource")]
    pub resource: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_resource")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub resource_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestScriptFixture {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptFixtureBuilder {
        TestScriptFixtureBuilder::default()
    }
}
/// Sub-fields of the variable field in TestScript
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptVariableBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptVariable {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Descriptive name for this variable**

 Descriptive name for this variable.

 Placeholders would contain the variable name wrapped in ${} in "operation.params", "operation.requestHeader.value", and "operation.url" elements.  These placeholders would need to be replaced by the variable value before the operation is executed. */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Default, hard-coded, or user-defined value for this variable**

 A default, hard-coded, or user-defined value for this variable.

 The purpose of this element is to allow for a pre-defined value that can be used as a default or as an override value. Test engines can optionally use this as a placeholder for user-defined execution time values. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "defaultValue")]
    pub default_value: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_defaultValue")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub default_value_ext: Option<FieldExtension>,
    /** **Natural language description of the variable**

 A free text natural language description of the variable and its purpose.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **The fluentpath expression against the fixture body**

 The fluentpath expression to evaluate against the fixture body. When variables are defined, only one of either expression, headerField or path must be specified.

 If headerField is defined, then the variable will be evaluated against the headers that sourceId is pointing to.  If expression or path is defined, then the variable will be evaluated against the fixture body that sourceId is pointing to.  It is an error to define any combination of expression, headerField and path. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "expression")]
    pub expression: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_expression")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub expression_ext: Option<FieldExtension>,
    /** **HTTP header field name for source**

 Will be used to grab the HTTP header field value from the headers that sourceId is pointing to.

 If headerField is defined, then the variable will be evaluated against the headers that sourceId is pointing to.  If path is defined, then the variable will be evaluated against the fixture body that sourceId is pointing to.  It is an error to define both headerField and path. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "headerField")]
    pub header_field: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_headerField")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub header_field_ext: Option<FieldExtension>,
    /** **Hint help text for default value to enter**

 Displayable text string with hint help information to the user when entering a default value.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "hint")]
    pub hint: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_hint")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub hint_ext: Option<FieldExtension>,
    /** **XPath or JSONPath against the fixture body**

 XPath or JSONPath to evaluate against the fixture body.  When variables are defined, only one of either expression, headerField or path must be specified.

 If headerField is defined, then the variable will be evaluated against the headers that sourceId is pointing to.  If expression or path is defined, then the variable will be evaluated against the fixture body that sourceId is pointing to.  It is an error to define any combination of expression, headerField and path. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "path")]
    pub path: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_path")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub path_ext: Option<FieldExtension>,
    /** **Fixture Id of source expression or headerField within this variable**

 Fixture to evaluate the XPath/JSONPath expression or the headerField  against within this variable.

 This can be a statically defined fixture (at the top of the TestScript) or a dynamically set fixture created by responseId of the `action.operation` element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sourceId")]
    pub source_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sourceId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_id_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestScriptVariable {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptVariableBuilder {
        TestScriptVariableBuilder::default()
    }
}
/// Sub-fields of the rule field in TestScript
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptRuleBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptRule {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Assert rule resource reference**

 Reference to the resource (containing the contents of the rule needed for assertions).

 */
    #[serde(rename = "resource")]
    pub resource: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_resource")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub resource_ext: Option<FieldExtension>,
    /** **Rule parameter template**

 Each rule template can take one or more parameters for rule evaluation.

 The parameter value can be dynamic at runtime. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "param")]
    pub param: Vec<Option<TestScriptRuleParam>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_param")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub param_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl TestScriptRule {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptRuleBuilder {
        TestScriptRuleBuilder::default()
    }
}
/// Sub-fields of the param field in TestScriptRule
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptRuleParamBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptRuleParam {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Parameter name matching external assert rule parameter**

 Descriptive name for this parameter that matches the external assert rule parameter name.

 The external rule template would be looking for the parameter by this name. */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Parameter value defined either explicitly or dynamically**

 The explicit or dynamic value for the parameter that will be passed on to the external rule template.

 This value can be overwritten by the assert.rule.param.value i.e. TestScript.rule.param.value will be used if assert.rule.param.value is not specified.  The param value can be a string-representation of a number, string, or boolean that is expected. Test engines do have to look for placeholders (${}) and replace the variable placeholders with the variable values at runtime before supplying this value to the external rule template. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "value")]
    pub value: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_value")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestScriptRuleParam {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptRuleParamBuilder {
        TestScriptRuleParamBuilder::default()
    }
}
/// Sub-fields of the ruleset field in TestScript
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptRulesetBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptRuleset {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Assert ruleset resource reference**

 Reference to the resource (containing the contents of the ruleset needed for assertions).

 */
    #[serde(rename = "resource")]
    pub resource: Reference,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_resource")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub resource_ext: Option<FieldExtension>,
    /** **The referenced rule within the ruleset**

 The referenced rule within the external ruleset template.

 This qualifies each param name so that  a parameter with the same name can be used differently by the different rules with the ruleset. */
    #[serde(rename = "rule")]
    pub rule: Vec<Option<TestScriptRulesetRule>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_rule")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub rule_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl TestScriptRuleset {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptRulesetBuilder {
        TestScriptRulesetBuilder::default()
    }
}
/// Sub-fields of the rule field in TestScriptRuleset
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptRulesetRuleBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptRulesetRule {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Id of referenced rule within the ruleset**

 Id of the referenced rule within the external ruleset template.

 */
    #[serde(rename = "ruleId")]
    pub rule_id: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_ruleId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub rule_id_ext: Option<FieldExtension>,
    /** **Ruleset rule parameter template**

 Each rule template can take one or more parameters for rule evaluation.

 The parameter value can be dynamic at runtime. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "param")]
    pub param: Vec<Option<TestScriptRulesetRuleParam>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_param")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub param_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl TestScriptRulesetRule {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptRulesetRuleBuilder {
        TestScriptRulesetRuleBuilder::default()
    }
}
/// Sub-fields of the param field in TestScriptRulesetRule
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptRulesetRuleParamBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptRulesetRuleParam {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Parameter name matching external assert ruleset rule parameter**

 Descriptive name for this parameter that matches the external assert ruleset rule parameter name.

 The external rule template would be looking for the parameter by this name. */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Parameter value defined either explicitly or dynamically**

 The value for the parameter that will be passed on to the external ruleset rule template.

 This value can be overwritten by the assert.ruleset.rule.param.value i.e. TestScript.ruleset.rule.param.value will be used if assert.ruleset.rule.param.value is not specified.  The param value can be a string-representation of a number, string, or boolean that is expected. Test engines do have to look for placeholders (${}) and replace the variable placeholders with the variable values at runtime before supplying this value to the external rule template. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "value")]
    pub value: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_value")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestScriptRulesetRuleParam {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptRulesetRuleParamBuilder {
        TestScriptRulesetRuleParamBuilder::default()
    }
}
/// Sub-fields of the setup field in TestScript
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptSetupBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptSetup {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **A setup operation or assert to perform**

 Action would contain either an operation or an assertion.

 An action should contain either an operation or an assertion but not both.  It can contain any number of variables. */
    #[serde(rename = "action")]
    pub action: Vec<Option<TestScriptSetupAction>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_action")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub action_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl TestScriptSetup {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptSetupBuilder {
        TestScriptSetupBuilder::default()
    }
}
/// Sub-fields of the action field in TestScriptSetup
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptSetupActionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptSetupAction {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **The setup operation to perform**

 The operation to perform.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "operation")]
    pub operation: Option<TestScriptSetupActionOperation>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_operation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub operation_ext: Option<FieldExtension>,
    /** **The assertion to perform**

 Evaluates the results of previous operations to determine if the server under test behaves appropriately.

 In order to evaluate an assertion, the request, response, and results of the most recently executed operation must always be maintained by the test engine. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "assert")]
    pub assert: Option<TestScriptSetupActionAssert>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_assert")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub assert_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestScriptSetupAction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptSetupActionBuilder {
        TestScriptSetupActionBuilder::default()
    }
}
/// Sub-fields of the operation field in TestScriptSetupAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptSetupActionOperationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptSetupActionOperation {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[TestScriptOperationCode](http://hl7.org/fhir/ValueSet/testscript-operation-codes); The operation code type that will be executed**

 Server interaction or operation type.

 See http://hl7.org/fhir/STU3/http.html for list of server interactions. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "type")]
    pub r#type: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_type")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#type_ext: Option<FieldExtension>,
    /** **[FHIRDefinedType](http://hl7.org/fhir/ValueSet/defined-types); Resource type**

 The type of the resource.  See http://hl7.org/fhir/STU3/resourcelist.html.

 If "url" element is specified, then "targetId", "params", and "resource" elements will be ignored as "url" element will have everything needed for constructing the request url.  If "params" element is specified, then "targetId" element is ignored. For FHIR operations that require a resource (e.g. "read" and "vread" operations), the "resource" element must be specified when "params" element is specified.  If "url" and "params" elements are absent, then the request url will be constructed from "targetId" fixture if present. For "read" operation, the resource and id values will be extracted from "targetId" fixture and used to construct the url. For "vread" and "history" operations, the versionId value will also be used. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "resource")]
    pub resource: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_resource")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub resource_ext: Option<FieldExtension>,
    /** **Tracking/logging operation label**

 The label would be used for tracking/logging purposes by test engines.

 This has no impact on the verification itself. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "label")]
    pub label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_label")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub label_ext: Option<FieldExtension>,
    /** **Tracking/reporting operation description**

 The description would be used by test engines for tracking and reporting purposes.

 This has no impact on the verification itself. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **[ContentType](http://hl7.org/fhir/ValueSet/content-type); xml | json | ttl | none**

 The content-type or mime-type to use for RESTful operation in the 'Accept' header.

 If this is specified, then test engine shall set the 'Accept' header to the corresponding value.    If 'xml' is specified, then 'Accept' header of 'application/fhir+xml' will be set.  If 'json' is specified, then 'application/fhir+json' will be used.    If you'd like to explicitly set the 'Accept' to some other value then use the 'requestHeader' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "accept")]
    pub accept: Option<codes::ContentType>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_accept")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub accept_ext: Option<FieldExtension>,
    /** **[ContentType](http://hl7.org/fhir/ValueSet/content-type); xml | json | ttl | none**

 The content-type or mime-type to use for RESTful operation in the 'Content-Type' header.

 If this is specified, then test engine shall set the 'Content-Type' header to the corresponding value.    If 'xml' is specified, then 'Content-Type' header of 'application/fhir+xml' will be set.    If 'json' is specified, then 'application/fhir+json' will be used.    If you'd like to explicitly set the 'Content-Type' to some other value then use the 'requestHeader' element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contentType")]
    pub content_type: Option<codes::ContentType>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_contentType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub content_type_ext: Option<FieldExtension>,
    /** **Server responding to the request**

 The server where the request message is destined for.  Must be one of the server numbers listed in TestScript.destination section.

 If multiple TestScript.destination elements are defined and operation.destination is undefined, test engine will report an error as it cannot determine what destination to use for the exchange. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "destination")]
    pub destination: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_destination")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub destination_ext: Option<FieldExtension>,
    /** **Whether or not to send the request url in encoded format**

 Whether or not to implicitly send the request url in encoded format. The default is true to match the standard RESTful client behavior. Set to false when communicating with a server that does not support encoded url paths.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "encodeRequestUrl")]
    pub encode_request_url: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_encodeRequestUrl")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub encode_request_url_ext: Option<FieldExtension>,
    /** **Server initiating the request**

 The server where the request message originates from.  Must be one of the server numbers listed in TestScript.origin section.

 If absent, test engine will send the message.  When present, test engine will not send the request message but will wait for the request message to be sent from this origin server. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "origin")]
    pub origin: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_origin")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub origin_ext: Option<FieldExtension>,
    /** **Explicitly defined path parameters**

 Path plus parameters after [type].  Used to set parts of the request URL explicitly.

 If "url" element is specified, then "targetId", "params", and "resource" elements will be ignored as "url" element will have everything needed for constructing the request url.  If "params" element is specified, then "targetId" element is ignored.  For FHIR operations that require a resource (e.g. "read" and "vread" operations), the "resource" element must be specified when "params" element is specified.  If "url" and "params" elements are absent, then the request url will be constructed from "targetId" fixture if present.  For "read" operation, the resource and id values will be extracted from "targetId" fixture and used to construct the url.  For "vread" and "history" operations, the versionId value will also be used.   Test engines would append whatever is specified for "params" to the URL after the resource type without tampering with the string (beyond encoding the URL for HTTP).  The "params" element does not correspond exactly to "search parameters".  Nor is it the "path".  It corresponds to the part of the URL that comes after the [type] (when "resource" element is specified); e.g. It corresponds to "/[id]/_history/[vid] {?_format=[mime-type]}" in the following operation: GET [base]/[type]/[id]/_history/[vid] {?_format=[mime-type]}  Test engines do have to look for placeholders (${}) and replace the variable placeholders with the variable values at runtime before sending the request. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "params")]
    pub params: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_params")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub params_ext: Option<FieldExtension>,
    /** **Each operation can have one or more header elements**

 Header elements would be used to set HTTP headers.

 This gives control to test-script writers to set headers explicitly based on test requirements.  It will allow for testing using:  - "If-Modified-Since" and "If-None-Match" headers.  See http://hl7.org/fhir/STU3/http.html#2.1.0.5.1 - "If-Match" header.  See http://hl7.org/fhir/STU3/http.html#2.1.0.11 - Conditional Create using "If-None-Exist".  See http://hl7.org/fhir/STU3/http.html#2.1.0.13.1 - Invalid "Content-Type" header for negative testing. - etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requestHeader")]
    pub request_header: Vec<Option<TestScriptSetupActionOperationRequestHeader>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_requestHeader")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub request_header_ext: Vec<Option<FieldExtension>>,
    /** **Fixture Id of mapped request**

 The fixture id (maybe new) to map to the request.

 If a requestId is supplied, then the resulting request (both headers and body) is mapped to the fixture ID (which may be entirely new and previously undeclared) designated by "requestId".  If requestId is not specified, it is the test engine's responsibility to store the request and use it as the requestId in subsequent assertions when assertion path and/or headerField is specified, direction is equal to request, and the requestId in not specified. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requestId")]
    pub request_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requestId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_id_ext: Option<FieldExtension>,
    /** **Fixture Id of mapped response**

 The fixture id (maybe new) to map to the response.

 If a responseId is supplied, and the server responds, then the resulting response (both headers and body) is mapped to the fixture ID (which may be entirely new and previously undeclared) designated by "responseId".  If responseId is not specified, it is the test engine's responsibility to store the response and use it as the responseId in subsequent assertions when assertion path and/or headerField is specified and the responseId is not specified. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "responseId")]
    pub response_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_responseId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub response_id_ext: Option<FieldExtension>,
    /** **Fixture Id of body for PUT and POST requests**

 The id of the fixture used as the body of a PUT or POST request.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sourceId")]
    pub source_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sourceId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_id_ext: Option<FieldExtension>,
    /** **Id of fixture used for extracting the [id],  [type], and [vid] for GET requests**

 Id of fixture used for extracting the [id],  [type], and [vid] for GET requests.

 If "url" element is specified, then "targetId", "params", and "resource" elements will be ignored as "url" element will have everything needed for constructing the request url.  If "params" element is specified, then "targetId" element is ignored.  For FHIR operations that require a resource (e.g. "read" and "vread" operations), the "resource" element must be specified when "params" element is specified.  If "url" and "params" elements are absent, then the request url will be constructed from "targetId" fixture if present.  For "read" operation, the resource and id values will be extracted from "targetId" fixture and used to construct the url.  For "vread" and "history" operations, the versionId value will also be used. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "targetId")]
    pub target_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_targetId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub target_id_ext: Option<FieldExtension>,
    /** **Request URL**

 Complete request URL.

 Used to set the request URL explicitly.  If "url" element is defined, then "targetId", "resource", and "params" elements will be ignored.  Test engines would use whatever is specified in "url" without tampering with the string (beyond encoding the URL for HTTP).  Test engines do have to look for placeholders (${}) and replace the variable placeholders with the variable values at runtime before sending the request. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "url")]
    pub url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestScriptSetupActionOperation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptSetupActionOperationBuilder {
        TestScriptSetupActionOperationBuilder::default()
    }
}
/// Sub-fields of the requestHeader field in TestScriptSetupActionOperation
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptSetupActionOperationRequestHeaderBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptSetupActionOperationRequestHeader {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **HTTP header field name**

 The HTTP header field e.g. "Accept".

 If header element is specified, then field is required. */
    #[serde(rename = "field")]
    pub field: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_field")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub field_ext: Option<FieldExtension>,
    /** **HTTP headerfield value**

 The value of the header e.g. "application/fhir+xml".

 If header element is specified, then value is required.  No conversions will be done by the test engine e.g. "xml" to "application/fhir+xml".  The values will be set in HTTP headers "as-is".  Test engines do have to look for placeholders (${}) and replace the variable placeholders with the variable values at runtime before sending the request. */
    #[serde(rename = "value")]
    pub value: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_value")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestScriptSetupActionOperationRequestHeader {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptSetupActionOperationRequestHeaderBuilder {
        TestScriptSetupActionOperationRequestHeaderBuilder::default()
    }
}
/// Sub-fields of the assert field in TestScriptSetupAction
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptSetupActionAssertBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptSetupActionAssert {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Tracking/logging assertion label**

 The label would be used for tracking/logging purposes by test engines.

 This has no impact on the verification itself. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "label")]
    pub label: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_label")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub label_ext: Option<FieldExtension>,
    /** **Tracking/reporting assertion description**

 The description would be used by test engines for tracking and reporting purposes.

 This has no impact on the verification itself. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **[AssertionDirectionType](http://hl7.org/fhir/ValueSet/assert-direction-codes); response | request**

 The direction to use for the assertion.

 If the direction is specified as "response" (the default), then the processing of this assert is against the received response message. If the direction is specified as "request", then the processing of this assert is against the sent request message. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "direction")]
    pub direction: Option<codes::AssertionDirectionType>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_direction")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub direction_ext: Option<FieldExtension>,
    /** **Id of the source fixture to be evaluated**

 Id of the source fixture used as the contents to be evaluated by either the "source/expression" or "sourceId/path" definition.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "compareToSourceId")]
    pub compare_to_source_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_compareToSourceId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub compare_to_source_id_ext: Option<FieldExtension>,
    /** **The fluentpath expression to evaluate against the source fixture**

 The fluentpath expression to evaluate against the source fixture. When compareToSourceId is defined, either compareToSourceExpression or compareToSourcePath must be defined, but not both.

 Thefhirpath expression to be evaluated against the expected fixture to compare to. Ignored if "assert.value" is used. The evaluation will be done before the assertion is evaluated. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "compareToSourceExpression")]
    pub compare_to_source_expression: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_compareToSourceExpression")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub compare_to_source_expression_ext: Option<FieldExtension>,
    /** **XPath or JSONPath expression to evaluate against the source fixture**

 XPath or JSONPath expression to evaluate against the source fixture. When compareToSourceId is defined, either compareToSourceExpression or compareToSourcePath must be defined, but not both.

 The XPath or JSONPath expression to be evaluated against the expected fixture to compare to. Ignored if "assert.value" is used. The evaluation will be done before the assertion is evaluated. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "compareToSourcePath")]
    pub compare_to_source_path: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_compareToSourcePath")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub compare_to_source_path_ext: Option<FieldExtension>,
    /** **[ContentType](http://hl7.org/fhir/ValueSet/content-type); xml | json | ttl | none**

 The content-type or mime-type to use for RESTful operation in the 'Content-Type' header.

 If this is specified, then test engine shall confirm that the content-type of the last operation's headers is set to this value.  If "assert.sourceId" element is specified, then the evaluation will be done against the headers mapped to that sourceId (and not the last operation's headers).    If 'xml' is specified, then 'Content-Type' header of 'application/fhir+xml' will be confirmed. If 'json' is specified, then 'application/fhir+json' will be used. If you'd like to have more control over the string, then use 'assert.headerField' instead. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contentType")]
    pub content_type: Option<codes::ContentType>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_contentType")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub content_type_ext: Option<FieldExtension>,
    /** **The fluentpath expression to be evaluated**

 The fluentpath expression to be evaluated against the request or response message contents - HTTP headers and payload.

 If both "expression" and a "fixtureId" are specified, then the expression will be evaluated against the request or response body mapped to the fixtureId.  If "expression" is specified and a "fixtureId" is not, then the expression will be evaluated against the response body of the last operation.  Test engines are to store the request and response body and headers of the last operation at all times for subsequent assertions. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "expression")]
    pub expression: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_expression")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub expression_ext: Option<FieldExtension>,
    /** **HTTP header field name**

 The HTTP header field name e.g. 'Location'.

 If "headerField" is specified then "value" must be specified.  If "sourceId" is not specified, then "headerField" will be evaluated against the last operation's response headers.  Test engines are to keep track of the last operation's response body and response headers. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "headerField")]
    pub header_field: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_headerField")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub header_field_ext: Option<FieldExtension>,
    /** **Fixture Id of minimum content resource**

 The ID of a fixture.  Asserts that the response contains at a minimum the fixture specified by minimumId.

 Asserts that the response contains all the element/content in another fixture pointed to by minimumId.  This can be a statically defined fixture or one that is dynamically set via responseId. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "minimumId")]
    pub minimum_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_minimumId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub minimum_id_ext: Option<FieldExtension>,
    /** **Perform validation on navigation links?**

 Whether or not the test execution performs validation on the bundle navigation links.

 Asserts that the Bundle contains first, last, and next links. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "navigationLinks")]
    pub navigation_links: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_navigationLinks")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub navigation_links_ext: Option<FieldExtension>,
    /** **[AssertionOperatorType](http://hl7.org/fhir/ValueSet/assert-operator-codes); equals | notEquals | in | notIn | greaterThan | lessThan | empty | notEmpty | contains | notContains | eval**

 The operator type defines the conditional behavior of the assert. If not defined, the default is equals.

 Operators are useful especially for negative testing.  If operator is not specified, then the "equals" operator is assumed; e.g. <code>   <assert>  <operator value="in" />  <responseCode value="200,201,204" />    </assert>    <assert>  <operator value="notEquals" />  <response value="okay"/>   </assert>    <assert>  <operator value="greaterThan" />    <responseHeader>     <field value="Content-Length" />     <value value="0" />    <responseHeader/>   </assert> </code>. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "operator")]
    pub operator: Option<codes::AssertionOperatorType>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_operator")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub operator_ext: Option<FieldExtension>,
    /** **XPath or JSONPath expression**

 The XPath or JSONPath expression to be evaluated against the fixture representing the response received from server.

 If both "path" and a "fixtureId" are specified, then the path will be evaluated against the request or response body mapped to the fixtureId.  If "path" is specified and a "fixtureId" is not, then the path will be evaluated against the response body of the last operation.  Test engines are to store the request and response body and headers of the last operation at all times for subsequent assertions. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "path")]
    pub path: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_path")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub path_ext: Option<FieldExtension>,
    /** **[TestScriptRequestMethodCode](http://hl7.org/fhir/ValueSet/http-operations); delete | get | options | patch | post | put**

 The request method or HTTP operation code to compare against that used by the client system under test.

 If "requestMethod" is specified then it will be used in place of "value". The "requestMethod" will evaluate against the last operation's request HTTP operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requestMethod")]
    pub request_method: Option<codes::TestScriptRequestMethodCode>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requestMethod")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_method_ext: Option<FieldExtension>,
    /** **Request URL comparison value**

 The value to use in a comparison against the request URL path string.

 If "requestURL" is specified then it will be used in place of "value". The "requestURL" will evaluate against the last operation's full request URL path string. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "requestURL")]
    pub request_url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_requestURL")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub request_url_ext: Option<FieldExtension>,
    /** **[FHIRDefinedType](http://hl7.org/fhir/ValueSet/defined-types); Resource type**

 The type of the resource.  See http://hl7.org/fhir/STU3/resourcelist.html.

 This will be expected resource type in response body e.g. in read, vread, search, etc.  See http://hl7.org/fhir/STU3/resourcelist.html for complete list of resource types; e.g. <assert > <resourceType value="Patient" </assert>. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "resource")]
    pub resource: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_resource")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub resource_ext: Option<FieldExtension>,
    /** **[AssertionResponseTypes](http://hl7.org/fhir/ValueSet/assert-response-code-types); okay | created | noContent | notModified | bad | forbidden | notFound | methodNotAllowed | conflict | gone | preconditionFailed | unprocessable**

 okay | created | noContent | notModified | bad | forbidden | notFound | methodNotAllowed | conflict | gone | preconditionFailed | unprocessable.

 This is a shorter way of achieving similar verifications via "assert.responseCode".  If you need more control, then use "assert.responseCode"  e.g. <assert>  <contentType value="json" />  <response value="okay"/> </assert>. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "response")]
    pub response: Option<codes::AssertionResponseTypes>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_response")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub response_ext: Option<FieldExtension>,
    /** **HTTP response code to test**

 The value of the HTTP response code to be tested.

 To be used with "operator" attribute value. Asserts that the response code equals this value if "operator" is not specified.   If the operator is "in" or "notIn" then the responseCode would be a comma-separated list of values e.g. "200,201". Otherwise, it's expected to be a numeric value.   If "fixture" is not specified, then the "responseBodyId" value of the last operation is assumed. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "responseCode")]
    pub response_code: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_responseCode")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub response_code_ext: Option<FieldExtension>,
    /** **The reference to a TestScript.rule**

 The TestScript.rule this assert will evaluate.

 Each rule should get evaluated by test engines as one assertion regardless of how many assertions are contained within the external rule template.  The impact of negative rule evaluation on test script execution is the same as an assertion failure which is descibed elsewhere in the TestScript resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "rule")]
    pub rule: Option<TestScriptSetupActionAssertRule>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_rule")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub rule_ext: Option<FieldExtension>,
    /** **The reference to a TestScript.ruleset**

 The TestScript.ruleset this assert will evaluate.

 Each rule within a ruleset should get evaluated by test engines as a separate assertion.  The impact of negative rule evaluation on test script execution is the same as an assertion failure which is descibed elsewhere in the TestScript resource.  If the first rule within the ruleset results in a failed assertion, then test engines do not have to evaluate the rest of the rules within the ruleset. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "ruleset")]
    pub ruleset: Option<TestScriptSetupActionAssertRuleset>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_ruleset")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub ruleset_ext: Option<FieldExtension>,
    /** **Fixture Id of source expression or headerField**

 Fixture to evaluate the XPath/JSONPath expression or the headerField  against.

 This can be a statically defined fixture (at the top of the testscript) or a dynamically set fixture created by responseId of the action.operation element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sourceId")]
    pub source_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sourceId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub source_id_ext: Option<FieldExtension>,
    /** **Profile Id of validation profile reference**

 The ID of the Profile to validate against.

 The ID of a Profile fixture. Asserts that the response is valid according to the Profile specified by validateProfileId. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "validateProfileId")]
    pub validate_profile_id: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_validateProfileId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub validate_profile_id_ext: Option<FieldExtension>,
    /** **The value to compare to**

 The value to compare to.

 The string-representation of a number, string, or boolean that is expected.  Test engines do have to look for placeholders (${}) and replace the variable placeholders with the variable values at runtime before comparing this value to the actual value. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "value")]
    pub value: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_value")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<FieldExtension>,
    /** **Will this assert produce a warning only on error?**

 Whether or not the test execution will produce a warning only on error for this assert.

 If this element is specified and it is true, then assertion failures can be logged by test engine but should not stop the test script execution from proceeding.  There are likely cases where the spec is not clear on what should happen. If the spec says something is optional (maybe a response header for example), but a server doesn’t do it, we could choose to issue a warning. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "warningOnly")]
    pub warning_only: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_warningOnly")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub warning_only_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestScriptSetupActionAssert {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptSetupActionAssertBuilder {
        TestScriptSetupActionAssertBuilder::default()
    }
}
/// Sub-fields of the rule field in TestScriptSetupActionAssert
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptSetupActionAssertRuleBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptSetupActionAssertRule {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Id of the TestScript.rule**

 The TestScript.rule id value this assert will evaluate.

 */
    #[serde(rename = "ruleId")]
    pub rule_id: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_ruleId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub rule_id_ext: Option<FieldExtension>,
    /** **Rule parameter template**

 Each rule template can take one or more parameters for rule evaluation.

 The parameter value can be dynamic at runtime. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "param")]
    pub param: Vec<Option<TestScriptSetupActionAssertRuleParam>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_param")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub param_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl TestScriptSetupActionAssertRule {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptSetupActionAssertRuleBuilder {
        TestScriptSetupActionAssertRuleBuilder::default()
    }
}
/// Sub-fields of the param field in TestScriptSetupActionAssertRule
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptSetupActionAssertRuleParamBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptSetupActionAssertRuleParam {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Parameter name matching external assert rule parameter**

 Descriptive name for this parameter that matches the external assert rule parameter name.

 The external rule template would be looking for the parameter by this name. */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Parameter value defined either explicitly or dynamically**

 The value for the parameter that will be passed on to the external rule template.

 This value overwrites the value (if any) specified in TestScript.rule.param.value.  The param value can be a string-representation of a number, string, or boolean that is expected.  Test engines do have to look for placeholders (${}) and replace the variable placeholders with the variable values at runtime before supplying this value to the external rule template. */
    #[serde(rename = "value")]
    pub value: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_value")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestScriptSetupActionAssertRuleParam {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptSetupActionAssertRuleParamBuilder {
        TestScriptSetupActionAssertRuleParamBuilder::default()
    }
}
/// Sub-fields of the ruleset field in TestScriptSetupActionAssert
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptSetupActionAssertRulesetBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptSetupActionAssertRuleset {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Id of the TestScript.ruleset**

 The TestScript.ruleset id value this assert will evaluate.

 */
    #[serde(rename = "rulesetId")]
    pub ruleset_id: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_rulesetId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub ruleset_id_ext: Option<FieldExtension>,
    /** **The referenced rule within the ruleset**

 The referenced rule within the external ruleset template.

 This qualifies each param name so that  a parameter with the same name can be used differently by the different rules with the ruleset. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "rule")]
    pub rule: Vec<Option<TestScriptSetupActionAssertRulesetRule>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_rule")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub rule_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl TestScriptSetupActionAssertRuleset {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptSetupActionAssertRulesetBuilder {
        TestScriptSetupActionAssertRulesetBuilder::default()
    }
}
/// Sub-fields of the rule field in TestScriptSetupActionAssertRuleset
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptSetupActionAssertRulesetRuleBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptSetupActionAssertRulesetRule {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Id of referenced rule within the ruleset**

 Id of the referenced rule within the external ruleset template.

 */
    #[serde(rename = "ruleId")]
    pub rule_id: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_ruleId")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub rule_id_ext: Option<FieldExtension>,
    /** **Rule parameter template**

 Each rule template can take one or more parameters for rule evaluation.

 The parameter value can be dynamic at runtime. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "param")]
    pub param: Vec<Option<TestScriptSetupActionAssertRulesetRuleParam>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_param")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub param_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl TestScriptSetupActionAssertRulesetRule {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptSetupActionAssertRulesetRuleBuilder {
        TestScriptSetupActionAssertRulesetRuleBuilder::default()
    }
}
/// Sub-fields of the param field in TestScriptSetupActionAssertRulesetRule
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptSetupActionAssertRulesetRuleParamBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptSetupActionAssertRulesetRuleParam {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Parameter name matching external assert ruleset rule parameter**

 Descriptive name for this parameter that matches the external assert ruleset rule parameter name.

 The external rule template would be looking for the parameter by this name. */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Parameter value defined either explicitly or dynamically**

 The value for the parameter that will be passed on to the external ruleset rule template.

 This value overwrites the value (if any) specified in TestScript.ruleset.rule.param.value.  The param value can be a string-representation of a number, string, or boolean that is expected.  Test engines do have to look for placeholders (${}) and replace the variable placeholders with the variable values at runtime before supplying this value to the external rule template. */
    #[serde(rename = "value")]
    pub value: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_value")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestScriptSetupActionAssertRulesetRuleParam {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptSetupActionAssertRulesetRuleParamBuilder {
        TestScriptSetupActionAssertRulesetRuleParamBuilder::default()
    }
}
/// Sub-fields of the test field in TestScript
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptTestBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptTest {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Tracking/logging name of this test**

 The name of this test used for tracking/logging purposes by test engines.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Tracking/reporting short description of the test**

 A short description of the test used by test engines for tracking and reporting purposes.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **A test operation or assert to perform**

 Action would contain either an operation or an assertion.

 An action should contain either an operation or an assertion but not both.  It can contain any number of variables. */
    #[serde(rename = "action")]
    pub action: Vec<Option<TestScriptTestAction>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_action")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub action_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl TestScriptTest {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptTestBuilder {
        TestScriptTestBuilder::default()
    }
}
/// Sub-fields of the action field in TestScriptTest
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptTestActionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptTestAction {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **The setup operation to perform**

 An operation would involve a REST request to a server.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "operation")]
    pub operation: Option<TestScriptSetupActionOperation>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_operation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub operation_ext: Option<FieldExtension>,
    /** **The setup assertion to perform**

 Evaluates the results of previous operations to determine if the server under test behaves appropriately.

 In order to evaluate an assertion, the request, response, and results of the most recently executed operation must always be maintained by the test engine. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "assert")]
    pub assert: Option<TestScriptSetupActionAssert>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_assert")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub assert_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestScriptTestAction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptTestActionBuilder {
        TestScriptTestActionBuilder::default()
    }
}
/// Sub-fields of the teardown field in TestScript
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptTeardownBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptTeardown {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **One or more teardown operations to perform**

 The teardown action will only contain an operation.

 An action should contain either an operation or an assertion but not both.  It can contain any number of variables. */
    #[serde(rename = "action")]
    pub action: Vec<Option<TestScriptTeardownAction>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_action")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub action_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl TestScriptTeardown {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptTeardownBuilder {
        TestScriptTeardownBuilder::default()
    }
}
/// Sub-fields of the action field in TestScriptTeardown
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "TestScriptTeardownActionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct TestScriptTeardownAction {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **The teardown operation to perform**

 An operation would involve a REST request to a server.

 */
    #[serde(rename = "operation")]
    pub operation: TestScriptSetupActionOperation,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_operation")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub operation_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl TestScriptTeardownAction {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> TestScriptTeardownActionBuilder {
        TestScriptTeardownActionBuilder::default()
    }
}
/** Base StructureDefinition for ValueSet Resource

 **[ValueSet](http://hl7.org/fhir/StructureDefinition/ValueSet) v3.0.2**

 A set of codes drawn from one or more code systems

 A value set specifies a set of codes drawn from one or more code systems.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct ValueSet(pub Box<ValueSetInner>);
/** Base StructureDefinition for ValueSet Resource

 **[ValueSet](http://hl7.org/fhir/StructureDefinition/ValueSet) v3.0.2**

 A set of codes drawn from one or more code systems

 A value set specifies a set of codes drawn from one or more code systems.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ValueSetBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct ValueSetInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "ValueSet::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::ValueSet", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Logical URI to reference this value set (globally unique)**

 An absolute URI that is used to identify this value set when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this value set is (or will be) published. The URL SHOULD include the major version of the value set. For more information see [Technical and Business Versions](resource.html#versions).

 Can be a urn:uuid: or a urn:oid:, but real http: addresses are preferred.  Multiple instances may share the same url if they have a distinct version. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "url")]
    pub url: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_url")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub url_ext: Option<FieldExtension>,
    /** **Additional identifier for the value set**

 A formal identifier that is used to identify this value set when it is represented in other formats, or referenced in a specification, model, design or an instance.

 Typically, this is used for identifiers that can go in an HL7 V3 II (instance identifier) data type, e.g., to identify this value set outside of FHIR, where it is not possible to use the logical URI. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **Business version of the value set**

 The identifier that is used to identify this version of the value set when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the value set author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.

 There may be different value set instances that have the same identifier but different versions.  The version can be appended to the url in a reference to allow a refrence to a particular business version of the value set with the format [url]|[version]. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Name for this value set (computer friendly)**

 A natural language name identifying the value set. This name should be usable as an identifier for the module by machine processing applications such as code generation.

 The name is not expected to be globally unique. The name should be a simple alpha-numeric type name to ensure that it is computable friendly. A name should be provided unless the value set is a contained resource (e.g. an anonymous value set in a profile). Most registries will require a name. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "name")]
    pub name: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Name for this value set (human friendly)**

 A short, descriptive, user-friendly title for the value set.

 This name does not need to be machine-processing friendly and may contain punctuation, white-space, etc. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "title")]
    pub title: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_title")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub title_ext: Option<FieldExtension>,
    /** **[PublicationStatus](http://hl7.org/fhir/ValueSet/publication-status); draft | active | retired | unknown**

 The status of this value set. Enables tracking the life-cycle of the content.

 Allows filtering of value sets that are appropriate for use vs. not.
This is labeled as "Is Modifier" because applications should not use a retired value set without due consideration. */
    #[serde(rename = "status")]
    pub status: codes::PublicationStatus,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **For testing purposes, not real usage**

 A boolean value to indicate that this value set is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.

 Allows filtering of value set that are appropriate for use vs. not. This is labeled as "Is Modifier" because applications should not use an experimental value set in production. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "experimental")]
    pub experimental: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_experimental")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub experimental_ext: Option<FieldExtension>,
    /** **Date this was last changed**

 The date  (and optionally time) when the value set was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the value set changes. (e.g. the 'content logical definition').

 Note that this is not the same as the resource last-modified-date, since the resource may be a secondary representation of the value set. Additional specific dates may be added as extensions or be found by consulting Provenances associated with past versions of the resource. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "date")]
    pub date: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_date")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_ext: Option<FieldExtension>,
    /** **Name of the publisher (organization or individual)**

 The name of the individual or organization that published the value set.

 Usually an organization, but may be an individual. The publisher (or steward) of the value set is the organization or individual primarily responsible for the maintenance and upkeep of the value set. This is not necessarily the same individual or organization that developed and initially authored the content. The publisher is the primary point of contact for questions or issues with the value set. This item SHOULD be populated unless the information is available from context. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "publisher")]
    pub publisher: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_publisher")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub publisher_ext: Option<FieldExtension>,
    /** **Contact details for the publisher**

 Contact details to assist a user in finding and communicating with the publisher.

 May be a web site, an email address, a telephone number, etc. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contact")]
    pub contact: Vec<Option<ContactDetail>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contact")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contact_ext: Vec<Option<FieldExtension>>,
    /** **Natural language description of the value set**

 A free text natural language description of the value set from a consumer's perspective.

 This description can be used to capture details such as why the value set was built, comments about misuse, instructions for clinical use and interpretation, literature references, examples from the paper world, etc. It is not a rendering of the value set as conveyed in the 'text' field of the resource itself. This item SHOULD be populated unless the information is available from context (e.g. the language of the profile is presumed to be the predominant language in the place the profile was created). The description is not intended to describe the semantics of the Value Set - there are no intrinsic semantics separate from the codes contained in its expansion. The description should capture its intended use, which is needed for ensuring integrity for its use in models across future changes. A description should be provided unless the value set is a contained resource (e.g. an anonymous value set in a profile). Most registries will require a description. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "description")]
    pub description: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_description")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub description_ext: Option<FieldExtension>,
    /** **Context the content is intended to support**

 The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate value set instances.

 When multiple useContexts are specified, there is no expectation whether all or any of the contexts apply. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "useContext")]
    pub use_context: Vec<Option<UsageContext>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_useContext")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub use_context_ext: Vec<Option<FieldExtension>>,
    /** **[Jurisdiction](http://hl7.org/fhir/ValueSet/jurisdiction); Intended jurisdiction for value set (if applicable)**

 A legal or geographic region in which the value set is intended to be used.

 It may be possible for the value set to be used in jurisdictions other than those for which it was originally designed or intended. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "jurisdiction")]
    pub jurisdiction: Vec<Option<CodeableConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_jurisdiction")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub jurisdiction_ext: Vec<Option<FieldExtension>>,
    /** **Indicates whether or not any change to the content logical definition may occur**

 If this is set to 'true', then no new versions of the content logical definition can be created.  Note: Other metadata might still change.

 Normally immutability is set to 'false', which is the default assumption if it is not populated.  Note that the implication is that if this is set to 'true', there may be only one ValueSet version for this definition. Immutability tends to be set to 'true' in one of two cases: - Where the value set, by the nature of its usage, cannot change.  For example "All specializations of ACT in ActClassCode" - Where there's no safe way to express the "Purpose" such that someone else could safely make changes to the value set definition. Source workflow control must guarantee that the same URI always yields the same definition. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "immutable")]
    pub immutable: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_immutable")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub immutable_ext: Option<FieldExtension>,
    /** **Why this value set is defined**

 Explaination of why this value set is needed and why it has been designed as it has.

 This element does not describe the usage of the value set Instead  it provides traceability of ''why'' the resource is either needed or ''why'' it is defined as it is.  This may be used to point to source materials or specifications that drove the structure of this value set. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "purpose")]
    pub purpose: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_purpose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub purpose_ext: Option<FieldExtension>,
    /** **Use and/or publishing restrictions**

 A copyright statement relating to the value set and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the value set.

 null Frequently, the copyright differs between the value set and the codes that are included. The copyright statement should clearly differentiate between these when required. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "copyright")]
    pub copyright: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_copyright")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub copyright_ext: Option<FieldExtension>,
    /** **Whether this is intended to be used with an extensible binding**

 Whether this is intended to be used with an extensible binding or not.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extensible")]
    pub extensible: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_extensible")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub extensible_ext: Option<FieldExtension>,
    /** **Definition of the content of the value set (CLD)**

 A set of criteria that define the content logical definition of the value set by including or excluding codes from outside this value set. This I also known as the "Content Logical Definition" (CLD).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "compose")]
    pub compose: Option<ValueSetCompose>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_compose")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub compose_ext: Option<FieldExtension>,
    /** **Used when the value set is "expanded"**

 A value set can also be "expanded", where the value set is turned into a simple collection of enumerated codes. This element holds the expansion, if it has been performed.

 Expansion is performed to produce a collection of codes that are ready to use for data entry or validation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "expansion")]
    pub expansion: Option<ValueSetExpansion>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_expansion")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub expansion_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ValueSetBuilder {
    #[doc = concat!("Finalize building ", "ValueSet", ".")]
    pub fn build(self) -> Result<ValueSet, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<ValueSetInner> for ValueSet {
    fn from(inner: ValueSetInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for ValueSet {
    type Target = ValueSetInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for ValueSet {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl ValueSet {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> ValueSetBuilder {
        ValueSetBuilder::default()
    }
}
impl ValueSet {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::ValueSet
    }
}
/// Sub-fields of the compose field in ValueSet
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ValueSetComposeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ValueSetCompose {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Fixed date for version-less references (transitive)**

 If a locked date is defined, then the Content Logical Definition must be evaluated using the current version as of the locked date for referenced code system(s) and value set instances where ValueSet.compose.include.version is not defined.

 With a defined lockedDate the value set is considered "Locked". Otherwise, the value set may have different expansions as underlying code systems and/or value sets evolve.  The interpretation of lockedDate is often dependent on the context - e.g. a SNOMED CT derived value set with a lockedDate will have a different expansion in USA than in UK.  If a value set specifies a version for include and exclude statements, and also specifies a locked date, the specified versions need to be available that date, or the value set will not be usable. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "lockedDate")]
    pub locked_date: Option<Date>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_lockedDate")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub locked_date_ext: Option<FieldExtension>,
    /** **Whether inactive codes are in the value set**

 Whether inactive codes - codes that are not approved for current use - are in the value set. If inactive = true, inactive codes are to be included in the expansion, if inactive = false, the inactive codes will not be included in the expansion. If absent, the behavior is determined by the implementation, or by the applicable ExpansionProfile (but generally, inactive codes would be expected to be included).

 Note that in the FHIR terminology framework, "deprecated" does not mean inactive, but in some code systems (e.g. LOINC, deprecated means inactive). Code systems should define what codes are considered to be inactive. If this is not clearly defined (including in the FHIR code system resource), then all codes are assumed to be active. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "inactive")]
    pub inactive: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_inactive")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub inactive_ext: Option<FieldExtension>,
    /** **Include one or more codes from a code system or other value set(s)**

 Include one or more codes from a code system or other value set(s).

 All the conditions in an include must be true. If a system is listed, all the codes from the system are listed. If one or more filters are listed, all of the filters must apply. If one or more value sets are listed, the codes must be in all the value sets. E.g. each include is 'include all the codes that meet all these conditions'. */
    #[serde(rename = "include")]
    pub include: Vec<Option<ValueSetComposeInclude>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_include")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub include_ext: Vec<Option<FieldExtension>>,
    /** **Explicitly exclude codes from a code system or other value sets**

 Exclude one or more codes from the value set based on code system filters and/or other value sets.

 Usually this is used to selectively exclude codes that were included by subsumption in the inclusions. Any display names specified for the codes are ignored. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "exclude")]
    pub exclude: Vec<Option<ValueSetComposeInclude>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_exclude")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub exclude_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ValueSetCompose {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ValueSetComposeBuilder {
        ValueSetComposeBuilder::default()
    }
}
/// Sub-fields of the include field in ValueSetCompose
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ValueSetComposeIncludeBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ValueSetComposeInclude {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **The system the codes come from**

 An absolute URI which is the code system from which the selected codes come from.

 If there are no codes or filters, the entire code system is included. Note that the set of codes that are included may contain abstract codes. See ''Coding.system'' for further documentation about the correct value for the system element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "system")]
    pub system: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_system")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub system_ext: Option<FieldExtension>,
    /** **Specific version of the code system referred to**

 The version of the code system that the codes are selected from.

 This is used when selecting the descendants of a concept - they may change between versions. If no version is specified, then the exact contents of the value set may not be known until a context of use binds it to a particular version. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **A concept defined in the system**

 Specifies a concept to be included or excluded.

 The list of concepts is considered ordered, though the order may not have any particular significance. Typically, the order of an expansion follows that defined in the compose element. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "concept")]
    pub concept: Vec<Option<ValueSetComposeIncludeConcept>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_concept")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub concept_ext: Vec<Option<FieldExtension>>,
    /** **Select codes/concepts by their properties (including relationships)**

 Select concepts by specify a matching criteria based on the properties (including relationships) defined by the system. If multiple filters are specified, they SHALL all be true.

 Selecting codes by specifying filters based on properties is only possible where the underlying code system defines appropriate properties. Note that in some cases, the underlying code system defines the logical concepts but not the literal codes for the concepts. In such cases, the literal definitions may be provided by a third party. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "filter")]
    pub filter: Vec<Option<ValueSetComposeIncludeFilter>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_filter")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub filter_ext: Vec<Option<FieldExtension>>,
    /** **Select only contents included in this value set**

 Selects concepts found in this value set. This is an absolute URI that is a reference to ValueSet.url.

 The value set URI is either a logical reference to a defined value set such as a [SNOMED CT reference set]{snomedct.html#implicit}, or a direct reference to a value set definition using ValueSet.url. The reference may not refer to an actual FHIR ValueSet resource; in this case, whatever is referred to is an implicit definition of a value set that needs to be clear about how versions are resolved. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "valueSet")]
    pub value_set: Vec<Option<String>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_valueSet")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub value_set_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ValueSetComposeInclude {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ValueSetComposeIncludeBuilder {
        ValueSetComposeIncludeBuilder::default()
    }
}
/// Sub-fields of the concept field in ValueSetComposeInclude
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ValueSetComposeIncludeConceptBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ValueSetComposeIncludeConcept {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Code or expression from system**

 Specifies a code for the concept to be included or excluded.

 Expressions are allowed if defined by the underlying code system. */
    #[serde(rename = "code")]
    pub code: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **Text to display for this code for this value set in this valueset**

 The text to display to the user for this concept in the context of this valueset. If no display is provided, then applications using the value set use the display specified for the code by the system.

 The value set resource allows for an alternative display to be specified for when this concept is used in this particular value set. See notes in the value set narrative about the correct use of this element. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "display")]
    pub display: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_display")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub display_ext: Option<FieldExtension>,
    /** **Additional representations for this concept**

 Additional representations for this concept when used in this value set - other languages, aliases, specialized purposes, used for particular purposes, etc.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "designation")]
    pub designation: Vec<Option<ValueSetComposeIncludeConceptDesignation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_designation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub designation_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ValueSetComposeIncludeConcept {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ValueSetComposeIncludeConceptBuilder {
        ValueSetComposeIncludeConceptBuilder::default()
    }
}
/// Sub-fields of the designation field in ValueSetComposeIncludeConcept
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ValueSetComposeIncludeConceptDesignationBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ValueSetComposeIncludeConceptDesignation {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Human language of the designation**

 The language this designation is defined for.

 In the absence of a language, the resource language applies. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_language")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub language_ext: Option<FieldExtension>,
    /** **[ConceptDesignationUse](http://hl7.org/fhir/ValueSet/designation-use); Details how this designation would be used**

 A code that details how this designation would be used.

 If no use is provided, the designation can be assumed to be suitable for general display to a human user. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "use")]
    pub r#use: Option<Coding>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_use")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#use_ext: Option<FieldExtension>,
    /** **The text value for this designation**

 The text value for this designation.

 */
    #[serde(rename = "value")]
    pub value: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_value")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ValueSetComposeIncludeConceptDesignation {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ValueSetComposeIncludeConceptDesignationBuilder {
        ValueSetComposeIncludeConceptDesignationBuilder::default()
    }
}
/// Sub-fields of the filter field in ValueSetComposeInclude
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ValueSetComposeIncludeFilterBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ValueSetComposeIncludeFilter {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **A property defined by the code system**

 A code that identifies a property defined in the code system.

 */
    #[serde(rename = "property")]
    pub property: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_property")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub property_ext: Option<FieldExtension>,
    /** **[FilterOperator](http://hl7.org/fhir/ValueSet/filter-operator); = | is-a | descendent-of | is-not-a | regex | in | not-in | generalizes | exists**

 The kind of operation to perform as a part of the filter criteria.

 */
    #[serde(rename = "op")]
    pub op: codes::FilterOperator,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_op")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub op_ext: Option<FieldExtension>,
    /** **Code from the system, or regex criteria, or boolean value for exists**

 The match value may be either a code defined by the system, or a string value, which is a regex match on the literal string of the property value when the operation is 'regex', or one of the values (true and false), when the operation is 'exists'.

 Use regex matching with care - full regex matching on every SNOMED CT term is prohibitive, for example. */
    #[serde(rename = "value")]
    pub value: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_value")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<FieldExtension>,
}
#[cfg(feature = "builders")]
impl ValueSetComposeIncludeFilter {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ValueSetComposeIncludeFilterBuilder {
        ValueSetComposeIncludeFilterBuilder::default()
    }
}
/// Sub-fields of the expansion field in ValueSet
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ValueSetExpansionBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ValueSetExpansion {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Uniquely identifies this expansion**

 An identifier that uniquely identifies this expansion of the valueset. Systems may re-use the same identifier as long as the expansion and the definition remain the same, but are not required to do so.

 Typically, this uri is a UUID (e.g. urn:uuid:8230ff20-c97a-4167-a59d-dc2cb9df16dd). */
    #[serde(rename = "identifier")]
    pub identifier: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub identifier_ext: Option<FieldExtension>,
    /** **Time ValueSet expansion happened**

 The time at which the expansion was produced by the expanding system.

 This SHOULD be a fully populated instant, but in some circumstances, value sets are expanded by hand, and the expansion is published without that precision. */
    #[serde(rename = "timestamp")]
    pub timestamp: DateTime,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_timestamp")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub timestamp_ext: Option<FieldExtension>,
    /** **Total number of codes in the expansion**

 The total number of concepts in the expansion. If the number of concept nodes in this resource is less than the stated number, then the server can return more using the offset parameter.

 Paging only applies to flat expansions. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "total")]
    pub total: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_total")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub total_ext: Option<FieldExtension>,
    /** **Offset at which this resource starts**

 If paging is being used, the offset at which this resource starts.  I.e. this resource is a partial view into the expansion. If paging is not being used, this element SHALL not be present.

 Paging only applies to flat expansions. If a filter is applied, the count is the number of concepts that matched the filter, not the number of concepts in an unfiltered view of the expansion. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "offset")]
    pub offset: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_offset")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub offset_ext: Option<FieldExtension>,
    /** **Parameter that controlled the expansion process**

 A parameter that controlled the expansion process. These parameters may be used by users of expanded value sets to check whether the expansion is suitable for a particular purpose, or to pick the correct expansion.

 The server decides which parameters to include here, but at a minimum, the list SHOULD include the date, filter, and profile parameters passed to the $expand operation (if any). */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "parameter")]
    pub parameter: Vec<Option<ValueSetExpansionParameter>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_parameter")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub parameter_ext: Vec<Option<FieldExtension>>,
    /** **Codes in the value set**

 The codes that are contained in the value set expansion.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contains")]
    pub contains: Vec<Option<ValueSetExpansionContains>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contains")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contains_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ValueSetExpansion {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ValueSetExpansionBuilder {
        ValueSetExpansionBuilder::default()
    }
}
/// Sub-fields of the parameter field in ValueSetExpansion
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ValueSetExpansionParameterBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ValueSetExpansionParameter {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Name as assigned by the server**

 The name of the parameter.

 The names are assigned at the discretion of the server. */
    #[serde(rename = "name")]
    pub name: String,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_name")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub name_ext: Option<FieldExtension>,
    /** **Value of the named parameter**

 The value of the parameter.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub value: Option<ValueSetExpansionParameterValue>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub value_ext: Option<ValueSetExpansionParameterValueExtension>,
}
#[cfg(feature = "builders")]
impl ValueSetExpansionParameter {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ValueSetExpansionParameterBuilder {
        ValueSetExpansionParameterBuilder::default()
    }
}
/// Choice of types for the value[x] field in ValueSetExpansionParameter
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ValueSetExpansionParameterValue {
    /// Variant accepting the String type.
    #[serde(rename = "valueString")]
    String(String),
    /// Variant accepting the Boolean type.
    #[serde(rename = "valueBoolean")]
    Boolean(bool),
    /// Variant accepting the Integer type.
    #[serde(rename = "valueInteger")]
    Integer(i32),
    /// Variant accepting the Decimal type.
    #[serde(rename = "valueDecimal")]
    Decimal(f64),
    /// Variant accepting the Uri type.
    #[serde(rename = "valueUri")]
    Uri(String),
    /// Variant accepting the Code type.
    #[serde(rename = "valueCode")]
    Code(String),
}
/// Extension value for ValueSetExpansionParameterValue.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum ValueSetExpansionParameterValueExtension {
    /// Variant accepting the String extension.
    #[serde(rename = "_valueString")]
    String(FieldExtension),
    /// Variant accepting the Boolean extension.
    #[serde(rename = "_valueBoolean")]
    Boolean(FieldExtension),
    /// Variant accepting the Integer extension.
    #[serde(rename = "_valueInteger")]
    Integer(FieldExtension),
    /// Variant accepting the Decimal extension.
    #[serde(rename = "_valueDecimal")]
    Decimal(FieldExtension),
    /// Variant accepting the Uri extension.
    #[serde(rename = "_valueUri")]
    Uri(FieldExtension),
    /// Variant accepting the Code extension.
    #[serde(rename = "_valueCode")]
    Code(FieldExtension),
}
/// Sub-fields of the contains field in ValueSetExpansion
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "ValueSetExpansionContainsBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct ValueSetExpansionContains {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **System value for the code**

 An absolute URI which is the code system in which the code for this item in the expansion is defined.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "system")]
    pub system: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_system")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub system_ext: Option<FieldExtension>,
    /** **If user cannot select this entry**

 If true, this entry is included in the expansion for navigational purposes, and the user cannot select the code directly as a proper value.

 This should not be understood to exclude its use for searching (e.g. by subsumption testing). The client should know whether it is appropriate for the user to select an abstract code or not. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "abstract")]
    pub r#abstract: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_abstract")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub r#abstract_ext: Option<FieldExtension>,
    /** **If concept is inactive in the code system**

 If the concept is inactive in the code system that defines it. Inactive codes are those that are no longer to be used, but are maintained by the code system for understanding legacy data.

 This should only have a value if the concept is inactive. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "inactive")]
    pub inactive: Option<bool>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_inactive")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub inactive_ext: Option<FieldExtension>,
    /** **Version in which this code/display is defined**

 The version of this code system that defined this code and/or display. This should only be used with code systems that do not enforce concept permanence.

 The exact value of the version string is specified by the system from which the code is derived. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "version")]
    pub version: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_version")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub version_ext: Option<FieldExtension>,
    /** **Code - if blank, this is not a selectable code**

 The code for this item in the expansion hierarchy. If this code is missing the entry in the hierarchy is a place holder (abstract) and does not represent a valid code in the value set.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "code")]
    pub code: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_code")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub code_ext: Option<FieldExtension>,
    /** **User display for the concept**

 The recommended display for this item in the expansion.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "display")]
    pub display: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_display")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub display_ext: Option<FieldExtension>,
    /** **Additional representations for this item**

 Additional representations for this item - other languages, aliases, specialized purposes, used for particular purposes, etc. These are relevant when the conditions of the expansion do not fix to a single correct representation.

 The designations provided must be based on the value set and code system definitions. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "designation")]
    pub designation: Vec<Option<ValueSetComposeIncludeConceptDesignation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_designation")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub designation_ext: Vec<Option<FieldExtension>>,
    /** **Codes contained under this entry**

 Other codes and entries contained under this entry in the hierarchy.

 If the expansion uses this element, there is  no implication about the logical relationship between them, and the  structure cannot be used for logical inferencing. The structure  exists to provide navigational assistance for helping human users to  locate codes in the expansion. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contains")]
    pub contains: Vec<Option<ValueSetExpansionContains>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_contains")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub contains_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl ValueSetExpansionContains {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> ValueSetExpansionContainsBuilder {
        ValueSetExpansionContainsBuilder::default()
    }
}
/** Base StructureDefinition for VisionPrescription Resource

 **[VisionPrescription](http://hl7.org/fhir/StructureDefinition/VisionPrescription) v3.0.2**

 Prescription for vision correction products for a patient

 An authorization for the supply of glasses and/or contact lenses to a patient.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(transparent)]
pub struct VisionPrescription(pub Box<VisionPrescriptionInner>);
/** Base StructureDefinition for VisionPrescription Resource

 **[VisionPrescription](http://hl7.org/fhir/StructureDefinition/VisionPrescription) v3.0.2**

 Prescription for vision correction products for a patient

 An authorization for the supply of glasses and/or contact lenses to a patient.

 */
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "VisionPrescriptionBuilder",
        build_fn(error = "crate::error::BuilderError", name = "build_inner"),
    )
)]
pub struct VisionPrescriptionInner {
    /// Type of this FHIR resource.
    #[doc(hidden)]
    #[serde(default = "VisionPrescription::resource_type")]
    #[cfg_attr(
        feature = "builders",
        builder(default = "ResourceType::VisionPrescription", setter(skip))
    )]
    resource_type: ResourceType,
    /** **Logical id of this artifact**

 The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.

 The only time that a resource does not have an id is when it is being submitted to the server using a create operation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Metadata about the resource**

 The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "meta")]
    pub meta: Option<Meta>,
    /** **A set of rules under which this content was created**

 A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content.

 Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element.

This element is labelled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "implicitRules")]
    pub implicit_rules: Option<String>,
    /** **[Language](http://hl7.org/fhir/ValueSet/languages); Language of the resource content**

 The base language in which the resource is written.

 Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies  to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource  Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute). */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "language")]
    pub language: Option<String>,
    /** **Text summary of the resource, for human interpretation**

 A human-readable narrative that contains a summary of the resource, and may be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.

 Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied).  This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded in formation is added later. */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "text")]
    pub text: Option<Narrative>,
    /** **Contained, inline Resources**

 These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.

 This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "contained")]
    pub contained: Vec<Resource>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the resource. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the resource, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **Business identifier**

 Business identifier which may be used by other parties to reference or identify the prescription.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "identifier")]
    pub identifier: Vec<Option<Identifier>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_identifier")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub identifier_ext: Vec<Option<FieldExtension>>,
    /** **[VisionStatus](http://hl7.org/fhir/ValueSet/fm-status); active | cancelled | draft | entered-in-error**

 The status of the resource instance.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "status")]
    pub status: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_status")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub status_ext: Option<FieldExtension>,
    /** **Who prescription is for**

 A link to a resource representing the person to whom the vision products will be supplied.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "patient")]
    pub patient: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_patient")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub patient_ext: Option<FieldExtension>,
    /** **Created during encounter / admission / stay**

 A link to a resource that identifies the particular occurrence of contact between patient and health care provider.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "encounter")]
    pub encounter: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_encounter")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub encounter_ext: Option<FieldExtension>,
    /** **When prescription was authorized**

 The date (and perhaps time) when the prescription was written.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dateWritten")]
    pub date_written: Option<DateTime>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_dateWritten")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub date_written_ext: Option<FieldExtension>,
    /** **Who authorizes the vision product**

 The healthcare professional responsible for authorizing the prescription.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "prescriber")]
    pub prescriber: Option<Reference>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_prescriber")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub prescriber_ext: Option<FieldExtension>,
    /** **Reason or indication for writing the prescription**

 Can be the reason or the indication for writing the prescription.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(flatten)]
    pub reason: Option<VisionPrescriptionReason>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(flatten)]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub reason_ext: Option<VisionPrescriptionReasonExtension>,
    /** **Vision supply authorization**

 Deals with details of the dispense part of the supply specification.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "dispense")]
    pub dispense: Vec<Option<VisionPrescriptionDispense>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_dispense")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub dispense_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl VisionPrescriptionBuilder {
    #[doc = concat!("Finalize building ", "VisionPrescription", ".")]
    pub fn build(self) -> Result<VisionPrescription, crate::error::BuilderError> {
        self.build_inner().map(Into::into)
    }
}
impl From<VisionPrescriptionInner> for VisionPrescription {
    fn from(inner: VisionPrescriptionInner) -> Self {
        Self(Box::new(inner))
    }
}
impl ::core::ops::Deref for VisionPrescription {
    type Target = VisionPrescriptionInner;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}
impl ::core::ops::DerefMut for VisionPrescription {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}
impl VisionPrescription {
    /// Start building an instance.
    #[cfg(feature = "builders")]
    #[must_use]
    pub fn builder() -> VisionPrescriptionBuilder {
        VisionPrescriptionBuilder::default()
    }
}
impl VisionPrescription {
    /// Get the resource type for this FHIR resource.
    #[must_use]
    pub const fn resource_type() -> ResourceType {
        ResourceType::VisionPrescription
    }
}
/// Choice of types for the reason[x] field in VisionPrescription
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum VisionPrescriptionReason {
    /// Variant accepting the CodeableConcept type.
    #[serde(rename = "reasonCodeableConcept")]
    CodeableConcept(CodeableConcept),
    /// Variant accepting the Reference type.
    #[serde(rename = "reasonReference")]
    Reference(Reference),
}
/// Extension value for VisionPrescriptionReason.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub enum VisionPrescriptionReasonExtension {
    /// Variant accepting the CodeableConcept extension.
    #[serde(rename = "_reasonCodeableConcept")]
    CodeableConcept(FieldExtension),
    /// Variant accepting the Reference extension.
    #[serde(rename = "_reasonReference")]
    Reference(FieldExtension),
}
/// Sub-fields of the dispense field in VisionPrescription
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "builders", derive(Builder))]
#[serde(rename_all = "camelCase")]
#[cfg_attr(
    feature = "builders",
    builder(
        pattern = "owned",
        name = "VisionPrescriptionDispenseBuilder",
        build_fn(error = "crate::error::BuilderError")
    )
)]
pub struct VisionPrescriptionDispense {
    /** **xml:id (or equivalent in JSON)**

 unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "id")]
    pub id: Option<String>,
    /** **Additional Content defined by implementations**

 May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "extension")]
    pub extension: Vec<Extension>,
    /** **Extensions that cannot be ignored**

 May be used to represent additional information that is not part of the basic definition of the element, and that modifies the understanding of the element that contains it. Usually modifier elements provide negation or qualification. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.

 There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions.  The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone. */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "modifierExtension")]
    pub modifier_extension: Vec<Extension>,
    /** **[VisionProduct](http://hl7.org/fhir/ValueSet/vision-product); Product to be supplied**

 Identifies the type of vision correction product which is required for the patient.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "product")]
    pub product: Option<CodeableConcept>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_product")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub product_ext: Option<FieldExtension>,
    /** **[VisionEyes](http://hl7.org/fhir/ValueSet/vision-eye-codes); right | left**

 The eye for which the lens applies.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "eye")]
    pub eye: Option<codes::VisionEyes>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_eye")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub eye_ext: Option<FieldExtension>,
    /** **Lens sphere**

 Lens power measured in diopters (0.25 units).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "sphere")]
    pub sphere: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_sphere")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub sphere_ext: Option<FieldExtension>,
    /** **Lens cylinder**

 Power adjustment for astigmatism measured in diopters (0.25 units).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "cylinder")]
    pub cylinder: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_cylinder")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub cylinder_ext: Option<FieldExtension>,
    /** **Lens axis**

 Adjustment for astigmatism measured in integer degrees.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "axis")]
    pub axis: Option<i32>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_axis")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub axis_ext: Option<FieldExtension>,
    /** **Lens prism**

 Amount of prism to compensate for eye alignment in fractional units.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "prism")]
    pub prism: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_prism")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub prism_ext: Option<FieldExtension>,
    /** **[VisionBase](http://hl7.org/fhir/ValueSet/vision-base-codes); up | down | in | out**

 The relative base, or reference lens edge, for the prism.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "base")]
    pub base: Option<codes::VisionBase>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_base")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub base_ext: Option<FieldExtension>,
    /** **Lens add**

 Power adjustment for multifocal lenses measured in diopters (0.25 units).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "add")]
    pub add: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_add")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub add_ext: Option<FieldExtension>,
    /** **Contact lens power**

 Contact lens power measured in diopters (0.25 units).

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "power")]
    pub power: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_power")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub power_ext: Option<FieldExtension>,
    /** **Contact lens back curvature**

 Back curvature measured in millimeters.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "backCurve")]
    pub back_curve: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_backCurve")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub back_curve_ext: Option<FieldExtension>,
    /** **Contact lens diameter**

 Contact lens diameter measured in millimeters.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "diameter")]
    pub diameter: Option<f64>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_diameter")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub diameter_ext: Option<FieldExtension>,
    /** **Lens wear duration**

 The recommended maximum wear period for the lens.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "duration")]
    pub duration: Option<Quantity>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_duration")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub duration_ext: Option<FieldExtension>,
    /** **Color required**

 Special color or pattern.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "color")]
    pub color: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_color")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub color_ext: Option<FieldExtension>,
    /** **Brand required**

 Brand recommendations or restrictions.

 */
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "brand")]
    pub brand: Option<String>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    #[serde(rename = "_brand")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    pub brand_ext: Option<FieldExtension>,
    /** **Notes for coatings**

 Notes for special requirements such as coatings and lens materials.

 */
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[cfg_attr(feature = "builders", builder(default, setter(strip_option)))]
    #[serde(rename = "note")]
    pub note: Vec<Option<Annotation>>,
    /// Extension field.
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    #[serde(rename = "_note")]
    #[cfg_attr(feature = "builders", builder(default))]
    pub note_ext: Vec<Option<FieldExtension>>,
}
#[cfg(feature = "builders")]
impl VisionPrescriptionDispense {
    ///Start building a new instance
    #[must_use]
    pub fn builder() -> VisionPrescriptionDispenseBuilder {
        VisionPrescriptionDispenseBuilder::default()
    }
}
/// Generic resource holding any FHIR resources.
#[derive(Debug, Clone, PartialEq, Deserialize)]
#[serde(tag = "resourceType")]
pub enum Resource {
    #[doc = stringify!(Account)]
    Account(Account),
    #[doc = stringify!(ActivityDefinition)]
    ActivityDefinition(ActivityDefinition),
    #[doc = stringify!(AdverseEvent)]
    AdverseEvent(AdverseEvent),
    #[doc = stringify!(AllergyIntolerance)]
    AllergyIntolerance(AllergyIntolerance),
    #[doc = stringify!(Appointment)]
    Appointment(Appointment),
    #[doc = stringify!(AppointmentResponse)]
    AppointmentResponse(AppointmentResponse),
    #[doc = stringify!(AuditEvent)]
    AuditEvent(AuditEvent),
    #[doc = stringify!(Basic)]
    Basic(Basic),
    #[doc = stringify!(Binary)]
    Binary(Binary),
    #[doc = stringify!(BodySite)]
    BodySite(BodySite),
    #[doc = stringify!(Bundle)]
    Bundle(Bundle),
    #[doc = stringify!(CapabilityStatement)]
    CapabilityStatement(CapabilityStatement),
    #[doc = stringify!(CarePlan)]
    CarePlan(CarePlan),
    #[doc = stringify!(CareTeam)]
    CareTeam(CareTeam),
    #[doc = stringify!(ChargeItem)]
    ChargeItem(ChargeItem),
    #[doc = stringify!(Claim)]
    Claim(Claim),
    #[doc = stringify!(ClaimResponse)]
    ClaimResponse(ClaimResponse),
    #[doc = stringify!(ClinicalImpression)]
    ClinicalImpression(ClinicalImpression),
    #[doc = stringify!(CodeSystem)]
    CodeSystem(CodeSystem),
    #[doc = stringify!(Communication)]
    Communication(Communication),
    #[doc = stringify!(CommunicationRequest)]
    CommunicationRequest(CommunicationRequest),
    #[doc = stringify!(CompartmentDefinition)]
    CompartmentDefinition(CompartmentDefinition),
    #[doc = stringify!(Composition)]
    Composition(Composition),
    #[doc = stringify!(ConceptMap)]
    ConceptMap(ConceptMap),
    #[doc = stringify!(Condition)]
    Condition(Condition),
    #[doc = stringify!(Consent)]
    Consent(Consent),
    #[doc = stringify!(Contract)]
    Contract(Contract),
    #[doc = stringify!(Coverage)]
    Coverage(Coverage),
    #[doc = stringify!(DataElement)]
    DataElement(DataElement),
    #[doc = stringify!(DetectedIssue)]
    DetectedIssue(DetectedIssue),
    #[doc = stringify!(Device)]
    Device(Device),
    #[doc = stringify!(DeviceComponent)]
    DeviceComponent(DeviceComponent),
    #[doc = stringify!(DeviceMetric)]
    DeviceMetric(DeviceMetric),
    #[doc = stringify!(DeviceRequest)]
    DeviceRequest(DeviceRequest),
    #[doc = stringify!(DeviceUseStatement)]
    DeviceUseStatement(DeviceUseStatement),
    #[doc = stringify!(DiagnosticReport)]
    DiagnosticReport(DiagnosticReport),
    #[doc = stringify!(DocumentManifest)]
    DocumentManifest(DocumentManifest),
    #[doc = stringify!(DocumentReference)]
    DocumentReference(DocumentReference),
    #[doc = stringify!(EligibilityRequest)]
    EligibilityRequest(EligibilityRequest),
    #[doc = stringify!(EligibilityResponse)]
    EligibilityResponse(EligibilityResponse),
    #[doc = stringify!(Encounter)]
    Encounter(Encounter),
    #[doc = stringify!(Endpoint)]
    Endpoint(Endpoint),
    #[doc = stringify!(EnrollmentRequest)]
    EnrollmentRequest(EnrollmentRequest),
    #[doc = stringify!(EnrollmentResponse)]
    EnrollmentResponse(EnrollmentResponse),
    #[doc = stringify!(EpisodeOfCare)]
    EpisodeOfCare(EpisodeOfCare),
    #[doc = stringify!(ExpansionProfile)]
    ExpansionProfile(ExpansionProfile),
    #[doc = stringify!(ExplanationOfBenefit)]
    ExplanationOfBenefit(ExplanationOfBenefit),
    #[doc = stringify!(FamilyMemberHistory)]
    FamilyMemberHistory(FamilyMemberHistory),
    #[doc = stringify!(Flag)]
    Flag(Flag),
    #[doc = stringify!(Goal)]
    Goal(Goal),
    #[doc = stringify!(GraphDefinition)]
    GraphDefinition(GraphDefinition),
    #[doc = stringify!(Group)]
    Group(Group),
    #[doc = stringify!(GuidanceResponse)]
    GuidanceResponse(GuidanceResponse),
    #[doc = stringify!(HealthcareService)]
    HealthcareService(HealthcareService),
    #[doc = stringify!(ImagingManifest)]
    ImagingManifest(ImagingManifest),
    #[doc = stringify!(ImagingStudy)]
    ImagingStudy(ImagingStudy),
    #[doc = stringify!(Immunization)]
    Immunization(Immunization),
    #[doc = stringify!(ImmunizationRecommendation)]
    ImmunizationRecommendation(ImmunizationRecommendation),
    #[doc = stringify!(ImplementationGuide)]
    ImplementationGuide(ImplementationGuide),
    #[doc = stringify!(Library)]
    Library(Library),
    #[doc = stringify!(Linkage)]
    Linkage(Linkage),
    #[doc = stringify!(List)]
    List(List),
    #[doc = stringify!(Location)]
    Location(Location),
    #[doc = stringify!(Measure)]
    Measure(Measure),
    #[doc = stringify!(MeasureReport)]
    MeasureReport(MeasureReport),
    #[doc = stringify!(Media)]
    Media(Media),
    #[doc = stringify!(Medication)]
    Medication(Medication),
    #[doc = stringify!(MedicationAdministration)]
    MedicationAdministration(MedicationAdministration),
    #[doc = stringify!(MedicationDispense)]
    MedicationDispense(MedicationDispense),
    #[doc = stringify!(MedicationRequest)]
    MedicationRequest(MedicationRequest),
    #[doc = stringify!(MedicationStatement)]
    MedicationStatement(MedicationStatement),
    #[doc = stringify!(MessageDefinition)]
    MessageDefinition(MessageDefinition),
    #[doc = stringify!(MessageHeader)]
    MessageHeader(MessageHeader),
    #[doc = stringify!(NamingSystem)]
    NamingSystem(NamingSystem),
    #[doc = stringify!(NutritionOrder)]
    NutritionOrder(NutritionOrder),
    #[doc = stringify!(Observation)]
    Observation(Observation),
    #[doc = stringify!(OperationDefinition)]
    OperationDefinition(OperationDefinition),
    #[doc = stringify!(OperationOutcome)]
    OperationOutcome(OperationOutcome),
    #[doc = stringify!(Organization)]
    Organization(Organization),
    #[doc = stringify!(Parameters)]
    Parameters(Parameters),
    #[doc = stringify!(Patient)]
    Patient(Patient),
    #[doc = stringify!(PaymentNotice)]
    PaymentNotice(PaymentNotice),
    #[doc = stringify!(PaymentReconciliation)]
    PaymentReconciliation(PaymentReconciliation),
    #[doc = stringify!(Person)]
    Person(Person),
    #[doc = stringify!(PlanDefinition)]
    PlanDefinition(PlanDefinition),
    #[doc = stringify!(Practitioner)]
    Practitioner(Practitioner),
    #[doc = stringify!(PractitionerRole)]
    PractitionerRole(PractitionerRole),
    #[doc = stringify!(Procedure)]
    Procedure(Procedure),
    #[doc = stringify!(ProcedureRequest)]
    ProcedureRequest(ProcedureRequest),
    #[doc = stringify!(ProcessRequest)]
    ProcessRequest(ProcessRequest),
    #[doc = stringify!(ProcessResponse)]
    ProcessResponse(ProcessResponse),
    #[doc = stringify!(Provenance)]
    Provenance(Provenance),
    #[doc = stringify!(Questionnaire)]
    Questionnaire(Questionnaire),
    #[doc = stringify!(QuestionnaireResponse)]
    QuestionnaireResponse(QuestionnaireResponse),
    #[doc = stringify!(ReferralRequest)]
    ReferralRequest(ReferralRequest),
    #[doc = stringify!(RelatedPerson)]
    RelatedPerson(RelatedPerson),
    #[doc = stringify!(RequestGroup)]
    RequestGroup(RequestGroup),
    #[doc = stringify!(ResearchStudy)]
    ResearchStudy(ResearchStudy),
    #[doc = stringify!(ResearchSubject)]
    ResearchSubject(ResearchSubject),
    #[doc = stringify!(RiskAssessment)]
    RiskAssessment(RiskAssessment),
    #[doc = stringify!(Schedule)]
    Schedule(Schedule),
    #[doc = stringify!(SearchParameter)]
    SearchParameter(SearchParameter),
    #[doc = stringify!(Sequence)]
    Sequence(Sequence),
    #[doc = stringify!(ServiceDefinition)]
    ServiceDefinition(ServiceDefinition),
    #[doc = stringify!(Slot)]
    Slot(Slot),
    #[doc = stringify!(Specimen)]
    Specimen(Specimen),
    #[doc = stringify!(StructureDefinition)]
    StructureDefinition(StructureDefinition),
    #[doc = stringify!(StructureMap)]
    StructureMap(StructureMap),
    #[doc = stringify!(Subscription)]
    Subscription(Subscription),
    #[doc = stringify!(Substance)]
    Substance(Substance),
    #[doc = stringify!(SupplyDelivery)]
    SupplyDelivery(SupplyDelivery),
    #[doc = stringify!(SupplyRequest)]
    SupplyRequest(SupplyRequest),
    #[doc = stringify!(Task)]
    Task(Task),
    #[doc = stringify!(TestReport)]
    TestReport(TestReport),
    #[doc = stringify!(TestScript)]
    TestScript(TestScript),
    #[doc = stringify!(ValueSet)]
    ValueSet(ValueSet),
    #[doc = stringify!(VisionPrescription)]
    VisionPrescription(VisionPrescription),
}
impl serde::Serialize for Resource {
    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Resource::Account(inner) => inner.serialize(serializer),
            Resource::ActivityDefinition(inner) => inner.serialize(serializer),
            Resource::AdverseEvent(inner) => inner.serialize(serializer),
            Resource::AllergyIntolerance(inner) => inner.serialize(serializer),
            Resource::Appointment(inner) => inner.serialize(serializer),
            Resource::AppointmentResponse(inner) => inner.serialize(serializer),
            Resource::AuditEvent(inner) => inner.serialize(serializer),
            Resource::Basic(inner) => inner.serialize(serializer),
            Resource::Binary(inner) => inner.serialize(serializer),
            Resource::BodySite(inner) => inner.serialize(serializer),
            Resource::Bundle(inner) => inner.serialize(serializer),
            Resource::CapabilityStatement(inner) => inner.serialize(serializer),
            Resource::CarePlan(inner) => inner.serialize(serializer),
            Resource::CareTeam(inner) => inner.serialize(serializer),
            Resource::ChargeItem(inner) => inner.serialize(serializer),
            Resource::Claim(inner) => inner.serialize(serializer),
            Resource::ClaimResponse(inner) => inner.serialize(serializer),
            Resource::ClinicalImpression(inner) => inner.serialize(serializer),
            Resource::CodeSystem(inner) => inner.serialize(serializer),
            Resource::Communication(inner) => inner.serialize(serializer),
            Resource::CommunicationRequest(inner) => inner.serialize(serializer),
            Resource::CompartmentDefinition(inner) => inner.serialize(serializer),
            Resource::Composition(inner) => inner.serialize(serializer),
            Resource::ConceptMap(inner) => inner.serialize(serializer),
            Resource::Condition(inner) => inner.serialize(serializer),
            Resource::Consent(inner) => inner.serialize(serializer),
            Resource::Contract(inner) => inner.serialize(serializer),
            Resource::Coverage(inner) => inner.serialize(serializer),
            Resource::DataElement(inner) => inner.serialize(serializer),
            Resource::DetectedIssue(inner) => inner.serialize(serializer),
            Resource::Device(inner) => inner.serialize(serializer),
            Resource::DeviceComponent(inner) => inner.serialize(serializer),
            Resource::DeviceMetric(inner) => inner.serialize(serializer),
            Resource::DeviceRequest(inner) => inner.serialize(serializer),
            Resource::DeviceUseStatement(inner) => inner.serialize(serializer),
            Resource::DiagnosticReport(inner) => inner.serialize(serializer),
            Resource::DocumentManifest(inner) => inner.serialize(serializer),
            Resource::DocumentReference(inner) => inner.serialize(serializer),
            Resource::EligibilityRequest(inner) => inner.serialize(serializer),
            Resource::EligibilityResponse(inner) => inner.serialize(serializer),
            Resource::Encounter(inner) => inner.serialize(serializer),
            Resource::Endpoint(inner) => inner.serialize(serializer),
            Resource::EnrollmentRequest(inner) => inner.serialize(serializer),
            Resource::EnrollmentResponse(inner) => inner.serialize(serializer),
            Resource::EpisodeOfCare(inner) => inner.serialize(serializer),
            Resource::ExpansionProfile(inner) => inner.serialize(serializer),
            Resource::ExplanationOfBenefit(inner) => inner.serialize(serializer),
            Resource::FamilyMemberHistory(inner) => inner.serialize(serializer),
            Resource::Flag(inner) => inner.serialize(serializer),
            Resource::Goal(inner) => inner.serialize(serializer),
            Resource::GraphDefinition(inner) => inner.serialize(serializer),
            Resource::Group(inner) => inner.serialize(serializer),
            Resource::GuidanceResponse(inner) => inner.serialize(serializer),
            Resource::HealthcareService(inner) => inner.serialize(serializer),
            Resource::ImagingManifest(inner) => inner.serialize(serializer),
            Resource::ImagingStudy(inner) => inner.serialize(serializer),
            Resource::Immunization(inner) => inner.serialize(serializer),
            Resource::ImmunizationRecommendation(inner) => inner.serialize(serializer),
            Resource::ImplementationGuide(inner) => inner.serialize(serializer),
            Resource::Library(inner) => inner.serialize(serializer),
            Resource::Linkage(inner) => inner.serialize(serializer),
            Resource::List(inner) => inner.serialize(serializer),
            Resource::Location(inner) => inner.serialize(serializer),
            Resource::Measure(inner) => inner.serialize(serializer),
            Resource::MeasureReport(inner) => inner.serialize(serializer),
            Resource::Media(inner) => inner.serialize(serializer),
            Resource::Medication(inner) => inner.serialize(serializer),
            Resource::MedicationAdministration(inner) => inner.serialize(serializer),
            Resource::MedicationDispense(inner) => inner.serialize(serializer),
            Resource::MedicationRequest(inner) => inner.serialize(serializer),
            Resource::MedicationStatement(inner) => inner.serialize(serializer),
            Resource::MessageDefinition(inner) => inner.serialize(serializer),
            Resource::MessageHeader(inner) => inner.serialize(serializer),
            Resource::NamingSystem(inner) => inner.serialize(serializer),
            Resource::NutritionOrder(inner) => inner.serialize(serializer),
            Resource::Observation(inner) => inner.serialize(serializer),
            Resource::OperationDefinition(inner) => inner.serialize(serializer),
            Resource::OperationOutcome(inner) => inner.serialize(serializer),
            Resource::Organization(inner) => inner.serialize(serializer),
            Resource::Parameters(inner) => inner.serialize(serializer),
            Resource::Patient(inner) => inner.serialize(serializer),
            Resource::PaymentNotice(inner) => inner.serialize(serializer),
            Resource::PaymentReconciliation(inner) => inner.serialize(serializer),
            Resource::Person(inner) => inner.serialize(serializer),
            Resource::PlanDefinition(inner) => inner.serialize(serializer),
            Resource::Practitioner(inner) => inner.serialize(serializer),
            Resource::PractitionerRole(inner) => inner.serialize(serializer),
            Resource::Procedure(inner) => inner.serialize(serializer),
            Resource::ProcedureRequest(inner) => inner.serialize(serializer),
            Resource::ProcessRequest(inner) => inner.serialize(serializer),
            Resource::ProcessResponse(inner) => inner.serialize(serializer),
            Resource::Provenance(inner) => inner.serialize(serializer),
            Resource::Questionnaire(inner) => inner.serialize(serializer),
            Resource::QuestionnaireResponse(inner) => inner.serialize(serializer),
            Resource::ReferralRequest(inner) => inner.serialize(serializer),
            Resource::RelatedPerson(inner) => inner.serialize(serializer),
            Resource::RequestGroup(inner) => inner.serialize(serializer),
            Resource::ResearchStudy(inner) => inner.serialize(serializer),
            Resource::ResearchSubject(inner) => inner.serialize(serializer),
            Resource::RiskAssessment(inner) => inner.serialize(serializer),
            Resource::Schedule(inner) => inner.serialize(serializer),
            Resource::SearchParameter(inner) => inner.serialize(serializer),
            Resource::Sequence(inner) => inner.serialize(serializer),
            Resource::ServiceDefinition(inner) => inner.serialize(serializer),
            Resource::Slot(inner) => inner.serialize(serializer),
            Resource::Specimen(inner) => inner.serialize(serializer),
            Resource::StructureDefinition(inner) => inner.serialize(serializer),
            Resource::StructureMap(inner) => inner.serialize(serializer),
            Resource::Subscription(inner) => inner.serialize(serializer),
            Resource::Substance(inner) => inner.serialize(serializer),
            Resource::SupplyDelivery(inner) => inner.serialize(serializer),
            Resource::SupplyRequest(inner) => inner.serialize(serializer),
            Resource::Task(inner) => inner.serialize(serializer),
            Resource::TestReport(inner) => inner.serialize(serializer),
            Resource::TestScript(inner) => inner.serialize(serializer),
            Resource::ValueSet(inner) => inner.serialize(serializer),
            Resource::VisionPrescription(inner) => inner.serialize(serializer),
        }
    }
}
/// Resource type field of the FHIR resources.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum ResourceType {
    #[doc = stringify!(Account)]
    Account,
    #[doc = stringify!(ActivityDefinition)]
    ActivityDefinition,
    #[doc = stringify!(AdverseEvent)]
    AdverseEvent,
    #[doc = stringify!(AllergyIntolerance)]
    AllergyIntolerance,
    #[doc = stringify!(Appointment)]
    Appointment,
    #[doc = stringify!(AppointmentResponse)]
    AppointmentResponse,
    #[doc = stringify!(AuditEvent)]
    AuditEvent,
    #[doc = stringify!(Basic)]
    Basic,
    #[doc = stringify!(Binary)]
    Binary,
    #[doc = stringify!(BodySite)]
    BodySite,
    #[doc = stringify!(Bundle)]
    Bundle,
    #[doc = stringify!(CapabilityStatement)]
    CapabilityStatement,
    #[doc = stringify!(CarePlan)]
    CarePlan,
    #[doc = stringify!(CareTeam)]
    CareTeam,
    #[doc = stringify!(ChargeItem)]
    ChargeItem,
    #[doc = stringify!(Claim)]
    Claim,
    #[doc = stringify!(ClaimResponse)]
    ClaimResponse,
    #[doc = stringify!(ClinicalImpression)]
    ClinicalImpression,
    #[doc = stringify!(CodeSystem)]
    CodeSystem,
    #[doc = stringify!(Communication)]
    Communication,
    #[doc = stringify!(CommunicationRequest)]
    CommunicationRequest,
    #[doc = stringify!(CompartmentDefinition)]
    CompartmentDefinition,
    #[doc = stringify!(Composition)]
    Composition,
    #[doc = stringify!(ConceptMap)]
    ConceptMap,
    #[doc = stringify!(Condition)]
    Condition,
    #[doc = stringify!(Consent)]
    Consent,
    #[doc = stringify!(Contract)]
    Contract,
    #[doc = stringify!(Coverage)]
    Coverage,
    #[doc = stringify!(DataElement)]
    DataElement,
    #[doc = stringify!(DetectedIssue)]
    DetectedIssue,
    #[doc = stringify!(Device)]
    Device,
    #[doc = stringify!(DeviceComponent)]
    DeviceComponent,
    #[doc = stringify!(DeviceMetric)]
    DeviceMetric,
    #[doc = stringify!(DeviceRequest)]
    DeviceRequest,
    #[doc = stringify!(DeviceUseStatement)]
    DeviceUseStatement,
    #[doc = stringify!(DiagnosticReport)]
    DiagnosticReport,
    #[doc = stringify!(DocumentManifest)]
    DocumentManifest,
    #[doc = stringify!(DocumentReference)]
    DocumentReference,
    #[doc = stringify!(EligibilityRequest)]
    EligibilityRequest,
    #[doc = stringify!(EligibilityResponse)]
    EligibilityResponse,
    #[doc = stringify!(Encounter)]
    Encounter,
    #[doc = stringify!(Endpoint)]
    Endpoint,
    #[doc = stringify!(EnrollmentRequest)]
    EnrollmentRequest,
    #[doc = stringify!(EnrollmentResponse)]
    EnrollmentResponse,
    #[doc = stringify!(EpisodeOfCare)]
    EpisodeOfCare,
    #[doc = stringify!(ExpansionProfile)]
    ExpansionProfile,
    #[doc = stringify!(ExplanationOfBenefit)]
    ExplanationOfBenefit,
    #[doc = stringify!(FamilyMemberHistory)]
    FamilyMemberHistory,
    #[doc = stringify!(Flag)]
    Flag,
    #[doc = stringify!(Goal)]
    Goal,
    #[doc = stringify!(GraphDefinition)]
    GraphDefinition,
    #[doc = stringify!(Group)]
    Group,
    #[doc = stringify!(GuidanceResponse)]
    GuidanceResponse,
    #[doc = stringify!(HealthcareService)]
    HealthcareService,
    #[doc = stringify!(ImagingManifest)]
    ImagingManifest,
    #[doc = stringify!(ImagingStudy)]
    ImagingStudy,
    #[doc = stringify!(Immunization)]
    Immunization,
    #[doc = stringify!(ImmunizationRecommendation)]
    ImmunizationRecommendation,
    #[doc = stringify!(ImplementationGuide)]
    ImplementationGuide,
    #[doc = stringify!(Library)]
    Library,
    #[doc = stringify!(Linkage)]
    Linkage,
    #[doc = stringify!(List)]
    List,
    #[doc = stringify!(Location)]
    Location,
    #[doc = stringify!(Measure)]
    Measure,
    #[doc = stringify!(MeasureReport)]
    MeasureReport,
    #[doc = stringify!(Media)]
    Media,
    #[doc = stringify!(Medication)]
    Medication,
    #[doc = stringify!(MedicationAdministration)]
    MedicationAdministration,
    #[doc = stringify!(MedicationDispense)]
    MedicationDispense,
    #[doc = stringify!(MedicationRequest)]
    MedicationRequest,
    #[doc = stringify!(MedicationStatement)]
    MedicationStatement,
    #[doc = stringify!(MessageDefinition)]
    MessageDefinition,
    #[doc = stringify!(MessageHeader)]
    MessageHeader,
    #[doc = stringify!(NamingSystem)]
    NamingSystem,
    #[doc = stringify!(NutritionOrder)]
    NutritionOrder,
    #[doc = stringify!(Observation)]
    Observation,
    #[doc = stringify!(OperationDefinition)]
    OperationDefinition,
    #[doc = stringify!(OperationOutcome)]
    OperationOutcome,
    #[doc = stringify!(Organization)]
    Organization,
    #[doc = stringify!(Parameters)]
    Parameters,
    #[doc = stringify!(Patient)]
    Patient,
    #[doc = stringify!(PaymentNotice)]
    PaymentNotice,
    #[doc = stringify!(PaymentReconciliation)]
    PaymentReconciliation,
    #[doc = stringify!(Person)]
    Person,
    #[doc = stringify!(PlanDefinition)]
    PlanDefinition,
    #[doc = stringify!(Practitioner)]
    Practitioner,
    #[doc = stringify!(PractitionerRole)]
    PractitionerRole,
    #[doc = stringify!(Procedure)]
    Procedure,
    #[doc = stringify!(ProcedureRequest)]
    ProcedureRequest,
    #[doc = stringify!(ProcessRequest)]
    ProcessRequest,
    #[doc = stringify!(ProcessResponse)]
    ProcessResponse,
    #[doc = stringify!(Provenance)]
    Provenance,
    #[doc = stringify!(Questionnaire)]
    Questionnaire,
    #[doc = stringify!(QuestionnaireResponse)]
    QuestionnaireResponse,
    #[doc = stringify!(ReferralRequest)]
    ReferralRequest,
    #[doc = stringify!(RelatedPerson)]
    RelatedPerson,
    #[doc = stringify!(RequestGroup)]
    RequestGroup,
    #[doc = stringify!(ResearchStudy)]
    ResearchStudy,
    #[doc = stringify!(ResearchSubject)]
    ResearchSubject,
    #[doc = stringify!(RiskAssessment)]
    RiskAssessment,
    #[doc = stringify!(Schedule)]
    Schedule,
    #[doc = stringify!(SearchParameter)]
    SearchParameter,
    #[doc = stringify!(Sequence)]
    Sequence,
    #[doc = stringify!(ServiceDefinition)]
    ServiceDefinition,
    #[doc = stringify!(Slot)]
    Slot,
    #[doc = stringify!(Specimen)]
    Specimen,
    #[doc = stringify!(StructureDefinition)]
    StructureDefinition,
    #[doc = stringify!(StructureMap)]
    StructureMap,
    #[doc = stringify!(Subscription)]
    Subscription,
    #[doc = stringify!(Substance)]
    Substance,
    #[doc = stringify!(SupplyDelivery)]
    SupplyDelivery,
    #[doc = stringify!(SupplyRequest)]
    SupplyRequest,
    #[doc = stringify!(Task)]
    Task,
    #[doc = stringify!(TestReport)]
    TestReport,
    #[doc = stringify!(TestScript)]
    TestScript,
    #[doc = stringify!(ValueSet)]
    ValueSet,
    #[doc = stringify!(VisionPrescription)]
    VisionPrescription,
}
impl ::core::fmt::Display for ResourceType {
    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
        f.write_str(self.as_str())
    }
}
impl From<Account> for Resource {
    fn from(resource: Account) -> Self {
        Self::Account(resource)
    }
}
impl TryFrom<Resource> for Account {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Account(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Account).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Account {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Account(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Account).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Account {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Account(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Account).to_owned())),
        }
    }
}
impl From<ActivityDefinition> for Resource {
    fn from(resource: ActivityDefinition) -> Self {
        Self::ActivityDefinition(resource)
    }
}
impl TryFrom<Resource> for ActivityDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ActivityDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ActivityDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ActivityDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ActivityDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ActivityDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ActivityDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ActivityDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ActivityDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<AdverseEvent> for Resource {
    fn from(resource: AdverseEvent) -> Self {
        Self::AdverseEvent(resource)
    }
}
impl TryFrom<Resource> for AdverseEvent {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::AdverseEvent(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(AdverseEvent).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a AdverseEvent {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::AdverseEvent(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(AdverseEvent).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut AdverseEvent {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::AdverseEvent(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(AdverseEvent).to_owned())),
        }
    }
}
impl From<AllergyIntolerance> for Resource {
    fn from(resource: AllergyIntolerance) -> Self {
        Self::AllergyIntolerance(resource)
    }
}
impl TryFrom<Resource> for AllergyIntolerance {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::AllergyIntolerance(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(AllergyIntolerance).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a AllergyIntolerance {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::AllergyIntolerance(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(AllergyIntolerance).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut AllergyIntolerance {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::AllergyIntolerance(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(AllergyIntolerance).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<Appointment> for Resource {
    fn from(resource: Appointment) -> Self {
        Self::Appointment(resource)
    }
}
impl TryFrom<Resource> for Appointment {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Appointment(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Appointment).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Appointment {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Appointment(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Appointment).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Appointment {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Appointment(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Appointment).to_owned())),
        }
    }
}
impl From<AppointmentResponse> for Resource {
    fn from(resource: AppointmentResponse) -> Self {
        Self::AppointmentResponse(resource)
    }
}
impl TryFrom<Resource> for AppointmentResponse {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::AppointmentResponse(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(AppointmentResponse).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a AppointmentResponse {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::AppointmentResponse(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(AppointmentResponse).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut AppointmentResponse {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::AppointmentResponse(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(AppointmentResponse).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<AuditEvent> for Resource {
    fn from(resource: AuditEvent) -> Self {
        Self::AuditEvent(resource)
    }
}
impl TryFrom<Resource> for AuditEvent {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::AuditEvent(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(AuditEvent).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a AuditEvent {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::AuditEvent(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(AuditEvent).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut AuditEvent {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::AuditEvent(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(AuditEvent).to_owned())),
        }
    }
}
impl From<Basic> for Resource {
    fn from(resource: Basic) -> Self {
        Self::Basic(resource)
    }
}
impl TryFrom<Resource> for Basic {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Basic(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Basic).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Basic {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Basic(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Basic).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Basic {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Basic(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Basic).to_owned())),
        }
    }
}
impl From<Binary> for Resource {
    fn from(resource: Binary) -> Self {
        Self::Binary(resource)
    }
}
impl TryFrom<Resource> for Binary {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Binary(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Binary).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Binary {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Binary(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Binary).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Binary {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Binary(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Binary).to_owned())),
        }
    }
}
impl From<BodySite> for Resource {
    fn from(resource: BodySite) -> Self {
        Self::BodySite(resource)
    }
}
impl TryFrom<Resource> for BodySite {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::BodySite(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(BodySite).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a BodySite {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::BodySite(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(BodySite).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut BodySite {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::BodySite(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(BodySite).to_owned())),
        }
    }
}
impl From<Bundle> for Resource {
    fn from(resource: Bundle) -> Self {
        Self::Bundle(resource)
    }
}
impl TryFrom<Resource> for Bundle {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Bundle(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Bundle).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Bundle {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Bundle(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Bundle).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Bundle {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Bundle(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Bundle).to_owned())),
        }
    }
}
impl From<CapabilityStatement> for Resource {
    fn from(resource: CapabilityStatement) -> Self {
        Self::CapabilityStatement(resource)
    }
}
impl TryFrom<Resource> for CapabilityStatement {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::CapabilityStatement(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(CapabilityStatement).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a CapabilityStatement {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::CapabilityStatement(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(CapabilityStatement).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut CapabilityStatement {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::CapabilityStatement(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(CapabilityStatement).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<CarePlan> for Resource {
    fn from(resource: CarePlan) -> Self {
        Self::CarePlan(resource)
    }
}
impl TryFrom<Resource> for CarePlan {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::CarePlan(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(CarePlan).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a CarePlan {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::CarePlan(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(CarePlan).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut CarePlan {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::CarePlan(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(CarePlan).to_owned())),
        }
    }
}
impl From<CareTeam> for Resource {
    fn from(resource: CareTeam) -> Self {
        Self::CareTeam(resource)
    }
}
impl TryFrom<Resource> for CareTeam {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::CareTeam(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(CareTeam).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a CareTeam {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::CareTeam(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(CareTeam).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut CareTeam {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::CareTeam(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(CareTeam).to_owned())),
        }
    }
}
impl From<ChargeItem> for Resource {
    fn from(resource: ChargeItem) -> Self {
        Self::ChargeItem(resource)
    }
}
impl TryFrom<Resource> for ChargeItem {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ChargeItem(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(ChargeItem).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ChargeItem {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ChargeItem(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(ChargeItem).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ChargeItem {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ChargeItem(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(ChargeItem).to_owned())),
        }
    }
}
impl From<Claim> for Resource {
    fn from(resource: Claim) -> Self {
        Self::Claim(resource)
    }
}
impl TryFrom<Resource> for Claim {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Claim(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Claim).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Claim {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Claim(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Claim).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Claim {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Claim(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Claim).to_owned())),
        }
    }
}
impl From<ClaimResponse> for Resource {
    fn from(resource: ClaimResponse) -> Self {
        Self::ClaimResponse(resource)
    }
}
impl TryFrom<Resource> for ClaimResponse {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ClaimResponse(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(ClaimResponse).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ClaimResponse {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ClaimResponse(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(ClaimResponse).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ClaimResponse {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ClaimResponse(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(ClaimResponse).to_owned()))
            }
        }
    }
}
impl From<ClinicalImpression> for Resource {
    fn from(resource: ClinicalImpression) -> Self {
        Self::ClinicalImpression(resource)
    }
}
impl TryFrom<Resource> for ClinicalImpression {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ClinicalImpression(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ClinicalImpression).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ClinicalImpression {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ClinicalImpression(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ClinicalImpression).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ClinicalImpression {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ClinicalImpression(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ClinicalImpression).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<CodeSystem> for Resource {
    fn from(resource: CodeSystem) -> Self {
        Self::CodeSystem(resource)
    }
}
impl TryFrom<Resource> for CodeSystem {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::CodeSystem(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(CodeSystem).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a CodeSystem {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::CodeSystem(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(CodeSystem).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut CodeSystem {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::CodeSystem(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(CodeSystem).to_owned())),
        }
    }
}
impl From<Communication> for Resource {
    fn from(resource: Communication) -> Self {
        Self::Communication(resource)
    }
}
impl TryFrom<Resource> for Communication {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Communication(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(Communication).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Communication {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Communication(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(Communication).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Communication {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Communication(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(Communication).to_owned()))
            }
        }
    }
}
impl From<CommunicationRequest> for Resource {
    fn from(resource: CommunicationRequest) -> Self {
        Self::CommunicationRequest(resource)
    }
}
impl TryFrom<Resource> for CommunicationRequest {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::CommunicationRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(CommunicationRequest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a CommunicationRequest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::CommunicationRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(CommunicationRequest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut CommunicationRequest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::CommunicationRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(CommunicationRequest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<CompartmentDefinition> for Resource {
    fn from(resource: CompartmentDefinition) -> Self {
        Self::CompartmentDefinition(resource)
    }
}
impl TryFrom<Resource> for CompartmentDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::CompartmentDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(CompartmentDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a CompartmentDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::CompartmentDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(CompartmentDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut CompartmentDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::CompartmentDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(CompartmentDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<Composition> for Resource {
    fn from(resource: Composition) -> Self {
        Self::Composition(resource)
    }
}
impl TryFrom<Resource> for Composition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Composition(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Composition).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Composition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Composition(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Composition).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Composition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Composition(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Composition).to_owned())),
        }
    }
}
impl From<ConceptMap> for Resource {
    fn from(resource: ConceptMap) -> Self {
        Self::ConceptMap(resource)
    }
}
impl TryFrom<Resource> for ConceptMap {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ConceptMap(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(ConceptMap).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ConceptMap {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ConceptMap(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(ConceptMap).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ConceptMap {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ConceptMap(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(ConceptMap).to_owned())),
        }
    }
}
impl From<Condition> for Resource {
    fn from(resource: Condition) -> Self {
        Self::Condition(resource)
    }
}
impl TryFrom<Resource> for Condition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Condition(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Condition).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Condition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Condition(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Condition).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Condition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Condition(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Condition).to_owned())),
        }
    }
}
impl From<Consent> for Resource {
    fn from(resource: Consent) -> Self {
        Self::Consent(resource)
    }
}
impl TryFrom<Resource> for Consent {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Consent(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Consent).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Consent {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Consent(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Consent).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Consent {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Consent(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Consent).to_owned())),
        }
    }
}
impl From<Contract> for Resource {
    fn from(resource: Contract) -> Self {
        Self::Contract(resource)
    }
}
impl TryFrom<Resource> for Contract {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Contract(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Contract).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Contract {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Contract(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Contract).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Contract {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Contract(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Contract).to_owned())),
        }
    }
}
impl From<Coverage> for Resource {
    fn from(resource: Coverage) -> Self {
        Self::Coverage(resource)
    }
}
impl TryFrom<Resource> for Coverage {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Coverage(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Coverage).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Coverage {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Coverage(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Coverage).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Coverage {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Coverage(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Coverage).to_owned())),
        }
    }
}
impl From<DataElement> for Resource {
    fn from(resource: DataElement) -> Self {
        Self::DataElement(resource)
    }
}
impl TryFrom<Resource> for DataElement {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DataElement(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(DataElement).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a DataElement {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DataElement(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(DataElement).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut DataElement {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DataElement(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(DataElement).to_owned())),
        }
    }
}
impl From<DetectedIssue> for Resource {
    fn from(resource: DetectedIssue) -> Self {
        Self::DetectedIssue(resource)
    }
}
impl TryFrom<Resource> for DetectedIssue {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DetectedIssue(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(DetectedIssue).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a DetectedIssue {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DetectedIssue(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(DetectedIssue).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut DetectedIssue {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DetectedIssue(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(DetectedIssue).to_owned()))
            }
        }
    }
}
impl From<Device> for Resource {
    fn from(resource: Device) -> Self {
        Self::Device(resource)
    }
}
impl TryFrom<Resource> for Device {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Device(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Device).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Device {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Device(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Device).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Device {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Device(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Device).to_owned())),
        }
    }
}
impl From<DeviceComponent> for Resource {
    fn from(resource: DeviceComponent) -> Self {
        Self::DeviceComponent(resource)
    }
}
impl TryFrom<Resource> for DeviceComponent {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DeviceComponent(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(DeviceComponent).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a DeviceComponent {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DeviceComponent(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(DeviceComponent).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut DeviceComponent {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DeviceComponent(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(DeviceComponent).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<DeviceMetric> for Resource {
    fn from(resource: DeviceMetric) -> Self {
        Self::DeviceMetric(resource)
    }
}
impl TryFrom<Resource> for DeviceMetric {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DeviceMetric(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(DeviceMetric).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a DeviceMetric {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DeviceMetric(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(DeviceMetric).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut DeviceMetric {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DeviceMetric(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(DeviceMetric).to_owned())),
        }
    }
}
impl From<DeviceRequest> for Resource {
    fn from(resource: DeviceRequest) -> Self {
        Self::DeviceRequest(resource)
    }
}
impl TryFrom<Resource> for DeviceRequest {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DeviceRequest(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(DeviceRequest).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a DeviceRequest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DeviceRequest(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(DeviceRequest).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut DeviceRequest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DeviceRequest(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(DeviceRequest).to_owned()))
            }
        }
    }
}
impl From<DeviceUseStatement> for Resource {
    fn from(resource: DeviceUseStatement) -> Self {
        Self::DeviceUseStatement(resource)
    }
}
impl TryFrom<Resource> for DeviceUseStatement {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DeviceUseStatement(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(DeviceUseStatement).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a DeviceUseStatement {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DeviceUseStatement(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(DeviceUseStatement).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut DeviceUseStatement {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DeviceUseStatement(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(DeviceUseStatement).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<DiagnosticReport> for Resource {
    fn from(resource: DiagnosticReport) -> Self {
        Self::DiagnosticReport(resource)
    }
}
impl TryFrom<Resource> for DiagnosticReport {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DiagnosticReport(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(DiagnosticReport).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a DiagnosticReport {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DiagnosticReport(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(DiagnosticReport).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut DiagnosticReport {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DiagnosticReport(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(DiagnosticReport).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<DocumentManifest> for Resource {
    fn from(resource: DocumentManifest) -> Self {
        Self::DocumentManifest(resource)
    }
}
impl TryFrom<Resource> for DocumentManifest {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DocumentManifest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(DocumentManifest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a DocumentManifest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DocumentManifest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(DocumentManifest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut DocumentManifest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DocumentManifest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(DocumentManifest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<DocumentReference> for Resource {
    fn from(resource: DocumentReference) -> Self {
        Self::DocumentReference(resource)
    }
}
impl TryFrom<Resource> for DocumentReference {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DocumentReference(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(DocumentReference).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a DocumentReference {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DocumentReference(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(DocumentReference).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut DocumentReference {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::DocumentReference(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(DocumentReference).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<EligibilityRequest> for Resource {
    fn from(resource: EligibilityRequest) -> Self {
        Self::EligibilityRequest(resource)
    }
}
impl TryFrom<Resource> for EligibilityRequest {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EligibilityRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(EligibilityRequest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a EligibilityRequest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EligibilityRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(EligibilityRequest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut EligibilityRequest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EligibilityRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(EligibilityRequest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<EligibilityResponse> for Resource {
    fn from(resource: EligibilityResponse) -> Self {
        Self::EligibilityResponse(resource)
    }
}
impl TryFrom<Resource> for EligibilityResponse {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EligibilityResponse(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(EligibilityResponse).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a EligibilityResponse {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EligibilityResponse(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(EligibilityResponse).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut EligibilityResponse {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EligibilityResponse(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(EligibilityResponse).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<Encounter> for Resource {
    fn from(resource: Encounter) -> Self {
        Self::Encounter(resource)
    }
}
impl TryFrom<Resource> for Encounter {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Encounter(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Encounter).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Encounter {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Encounter(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Encounter).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Encounter {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Encounter(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Encounter).to_owned())),
        }
    }
}
impl From<Endpoint> for Resource {
    fn from(resource: Endpoint) -> Self {
        Self::Endpoint(resource)
    }
}
impl TryFrom<Resource> for Endpoint {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Endpoint(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Endpoint).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Endpoint {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Endpoint(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Endpoint).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Endpoint {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Endpoint(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Endpoint).to_owned())),
        }
    }
}
impl From<EnrollmentRequest> for Resource {
    fn from(resource: EnrollmentRequest) -> Self {
        Self::EnrollmentRequest(resource)
    }
}
impl TryFrom<Resource> for EnrollmentRequest {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EnrollmentRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(EnrollmentRequest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a EnrollmentRequest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EnrollmentRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(EnrollmentRequest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut EnrollmentRequest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EnrollmentRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(EnrollmentRequest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<EnrollmentResponse> for Resource {
    fn from(resource: EnrollmentResponse) -> Self {
        Self::EnrollmentResponse(resource)
    }
}
impl TryFrom<Resource> for EnrollmentResponse {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EnrollmentResponse(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(EnrollmentResponse).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a EnrollmentResponse {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EnrollmentResponse(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(EnrollmentResponse).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut EnrollmentResponse {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EnrollmentResponse(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(EnrollmentResponse).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<EpisodeOfCare> for Resource {
    fn from(resource: EpisodeOfCare) -> Self {
        Self::EpisodeOfCare(resource)
    }
}
impl TryFrom<Resource> for EpisodeOfCare {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EpisodeOfCare(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(EpisodeOfCare).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a EpisodeOfCare {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EpisodeOfCare(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(EpisodeOfCare).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut EpisodeOfCare {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::EpisodeOfCare(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(EpisodeOfCare).to_owned()))
            }
        }
    }
}
impl From<ExpansionProfile> for Resource {
    fn from(resource: ExpansionProfile) -> Self {
        Self::ExpansionProfile(resource)
    }
}
impl TryFrom<Resource> for ExpansionProfile {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ExpansionProfile(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ExpansionProfile).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ExpansionProfile {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ExpansionProfile(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ExpansionProfile).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ExpansionProfile {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ExpansionProfile(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ExpansionProfile).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<ExplanationOfBenefit> for Resource {
    fn from(resource: ExplanationOfBenefit) -> Self {
        Self::ExplanationOfBenefit(resource)
    }
}
impl TryFrom<Resource> for ExplanationOfBenefit {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ExplanationOfBenefit(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ExplanationOfBenefit).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ExplanationOfBenefit {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ExplanationOfBenefit(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ExplanationOfBenefit).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ExplanationOfBenefit {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ExplanationOfBenefit(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ExplanationOfBenefit).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<FamilyMemberHistory> for Resource {
    fn from(resource: FamilyMemberHistory) -> Self {
        Self::FamilyMemberHistory(resource)
    }
}
impl TryFrom<Resource> for FamilyMemberHistory {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::FamilyMemberHistory(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(FamilyMemberHistory).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a FamilyMemberHistory {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::FamilyMemberHistory(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(FamilyMemberHistory).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut FamilyMemberHistory {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::FamilyMemberHistory(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(FamilyMemberHistory).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<Flag> for Resource {
    fn from(resource: Flag) -> Self {
        Self::Flag(resource)
    }
}
impl TryFrom<Resource> for Flag {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Flag(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Flag).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Flag {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Flag(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Flag).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Flag {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Flag(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Flag).to_owned())),
        }
    }
}
impl From<Goal> for Resource {
    fn from(resource: Goal) -> Self {
        Self::Goal(resource)
    }
}
impl TryFrom<Resource> for Goal {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Goal(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Goal).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Goal {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Goal(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Goal).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Goal {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Goal(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Goal).to_owned())),
        }
    }
}
impl From<GraphDefinition> for Resource {
    fn from(resource: GraphDefinition) -> Self {
        Self::GraphDefinition(resource)
    }
}
impl TryFrom<Resource> for GraphDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::GraphDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(GraphDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a GraphDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::GraphDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(GraphDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut GraphDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::GraphDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(GraphDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<Group> for Resource {
    fn from(resource: Group) -> Self {
        Self::Group(resource)
    }
}
impl TryFrom<Resource> for Group {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Group(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Group).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Group {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Group(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Group).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Group {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Group(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Group).to_owned())),
        }
    }
}
impl From<GuidanceResponse> for Resource {
    fn from(resource: GuidanceResponse) -> Self {
        Self::GuidanceResponse(resource)
    }
}
impl TryFrom<Resource> for GuidanceResponse {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::GuidanceResponse(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(GuidanceResponse).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a GuidanceResponse {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::GuidanceResponse(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(GuidanceResponse).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut GuidanceResponse {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::GuidanceResponse(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(GuidanceResponse).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<HealthcareService> for Resource {
    fn from(resource: HealthcareService) -> Self {
        Self::HealthcareService(resource)
    }
}
impl TryFrom<Resource> for HealthcareService {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::HealthcareService(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(HealthcareService).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a HealthcareService {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::HealthcareService(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(HealthcareService).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut HealthcareService {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::HealthcareService(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(HealthcareService).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<ImagingManifest> for Resource {
    fn from(resource: ImagingManifest) -> Self {
        Self::ImagingManifest(resource)
    }
}
impl TryFrom<Resource> for ImagingManifest {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ImagingManifest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ImagingManifest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ImagingManifest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ImagingManifest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ImagingManifest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ImagingManifest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ImagingManifest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ImagingManifest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<ImagingStudy> for Resource {
    fn from(resource: ImagingStudy) -> Self {
        Self::ImagingStudy(resource)
    }
}
impl TryFrom<Resource> for ImagingStudy {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ImagingStudy(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(ImagingStudy).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ImagingStudy {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ImagingStudy(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(ImagingStudy).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ImagingStudy {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ImagingStudy(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(ImagingStudy).to_owned())),
        }
    }
}
impl From<Immunization> for Resource {
    fn from(resource: Immunization) -> Self {
        Self::Immunization(resource)
    }
}
impl TryFrom<Resource> for Immunization {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Immunization(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Immunization).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Immunization {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Immunization(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Immunization).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Immunization {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Immunization(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Immunization).to_owned())),
        }
    }
}
impl From<ImmunizationRecommendation> for Resource {
    fn from(resource: ImmunizationRecommendation) -> Self {
        Self::ImmunizationRecommendation(resource)
    }
}
impl TryFrom<Resource> for ImmunizationRecommendation {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ImmunizationRecommendation(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ImmunizationRecommendation).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ImmunizationRecommendation {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ImmunizationRecommendation(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ImmunizationRecommendation).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ImmunizationRecommendation {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ImmunizationRecommendation(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ImmunizationRecommendation).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<ImplementationGuide> for Resource {
    fn from(resource: ImplementationGuide) -> Self {
        Self::ImplementationGuide(resource)
    }
}
impl TryFrom<Resource> for ImplementationGuide {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ImplementationGuide(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ImplementationGuide).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ImplementationGuide {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ImplementationGuide(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ImplementationGuide).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ImplementationGuide {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ImplementationGuide(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ImplementationGuide).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<Library> for Resource {
    fn from(resource: Library) -> Self {
        Self::Library(resource)
    }
}
impl TryFrom<Resource> for Library {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Library(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Library).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Library {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Library(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Library).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Library {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Library(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Library).to_owned())),
        }
    }
}
impl From<Linkage> for Resource {
    fn from(resource: Linkage) -> Self {
        Self::Linkage(resource)
    }
}
impl TryFrom<Resource> for Linkage {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Linkage(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Linkage).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Linkage {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Linkage(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Linkage).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Linkage {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Linkage(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Linkage).to_owned())),
        }
    }
}
impl From<List> for Resource {
    fn from(resource: List) -> Self {
        Self::List(resource)
    }
}
impl TryFrom<Resource> for List {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::List(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(List).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a List {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::List(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(List).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut List {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::List(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(List).to_owned())),
        }
    }
}
impl From<Location> for Resource {
    fn from(resource: Location) -> Self {
        Self::Location(resource)
    }
}
impl TryFrom<Resource> for Location {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Location(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Location).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Location {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Location(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Location).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Location {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Location(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Location).to_owned())),
        }
    }
}
impl From<Measure> for Resource {
    fn from(resource: Measure) -> Self {
        Self::Measure(resource)
    }
}
impl TryFrom<Resource> for Measure {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Measure(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Measure).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Measure {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Measure(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Measure).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Measure {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Measure(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Measure).to_owned())),
        }
    }
}
impl From<MeasureReport> for Resource {
    fn from(resource: MeasureReport) -> Self {
        Self::MeasureReport(resource)
    }
}
impl TryFrom<Resource> for MeasureReport {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MeasureReport(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(MeasureReport).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a MeasureReport {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MeasureReport(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(MeasureReport).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut MeasureReport {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MeasureReport(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(MeasureReport).to_owned()))
            }
        }
    }
}
impl From<Media> for Resource {
    fn from(resource: Media) -> Self {
        Self::Media(resource)
    }
}
impl TryFrom<Resource> for Media {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Media(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Media).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Media {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Media(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Media).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Media {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Media(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Media).to_owned())),
        }
    }
}
impl From<Medication> for Resource {
    fn from(resource: Medication) -> Self {
        Self::Medication(resource)
    }
}
impl TryFrom<Resource> for Medication {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Medication(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Medication).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Medication {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Medication(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Medication).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Medication {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Medication(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Medication).to_owned())),
        }
    }
}
impl From<MedicationAdministration> for Resource {
    fn from(resource: MedicationAdministration) -> Self {
        Self::MedicationAdministration(resource)
    }
}
impl TryFrom<Resource> for MedicationAdministration {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MedicationAdministration(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MedicationAdministration).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a MedicationAdministration {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MedicationAdministration(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MedicationAdministration).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut MedicationAdministration {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MedicationAdministration(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MedicationAdministration).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<MedicationDispense> for Resource {
    fn from(resource: MedicationDispense) -> Self {
        Self::MedicationDispense(resource)
    }
}
impl TryFrom<Resource> for MedicationDispense {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MedicationDispense(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MedicationDispense).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a MedicationDispense {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MedicationDispense(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MedicationDispense).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut MedicationDispense {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MedicationDispense(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MedicationDispense).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<MedicationRequest> for Resource {
    fn from(resource: MedicationRequest) -> Self {
        Self::MedicationRequest(resource)
    }
}
impl TryFrom<Resource> for MedicationRequest {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MedicationRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MedicationRequest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a MedicationRequest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MedicationRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MedicationRequest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut MedicationRequest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MedicationRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MedicationRequest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<MedicationStatement> for Resource {
    fn from(resource: MedicationStatement) -> Self {
        Self::MedicationStatement(resource)
    }
}
impl TryFrom<Resource> for MedicationStatement {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MedicationStatement(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MedicationStatement).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a MedicationStatement {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MedicationStatement(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MedicationStatement).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut MedicationStatement {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MedicationStatement(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MedicationStatement).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<MessageDefinition> for Resource {
    fn from(resource: MessageDefinition) -> Self {
        Self::MessageDefinition(resource)
    }
}
impl TryFrom<Resource> for MessageDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MessageDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MessageDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a MessageDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MessageDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MessageDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut MessageDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MessageDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(MessageDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<MessageHeader> for Resource {
    fn from(resource: MessageHeader) -> Self {
        Self::MessageHeader(resource)
    }
}
impl TryFrom<Resource> for MessageHeader {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MessageHeader(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(MessageHeader).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a MessageHeader {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MessageHeader(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(MessageHeader).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut MessageHeader {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::MessageHeader(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(MessageHeader).to_owned()))
            }
        }
    }
}
impl From<NamingSystem> for Resource {
    fn from(resource: NamingSystem) -> Self {
        Self::NamingSystem(resource)
    }
}
impl TryFrom<Resource> for NamingSystem {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::NamingSystem(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(NamingSystem).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a NamingSystem {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::NamingSystem(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(NamingSystem).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut NamingSystem {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::NamingSystem(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(NamingSystem).to_owned())),
        }
    }
}
impl From<NutritionOrder> for Resource {
    fn from(resource: NutritionOrder) -> Self {
        Self::NutritionOrder(resource)
    }
}
impl TryFrom<Resource> for NutritionOrder {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::NutritionOrder(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(NutritionOrder).to_owned()),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a NutritionOrder {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::NutritionOrder(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(NutritionOrder).to_owned()),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut NutritionOrder {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::NutritionOrder(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(NutritionOrder).to_owned()),
                )
            }
        }
    }
}
impl From<Observation> for Resource {
    fn from(resource: Observation) -> Self {
        Self::Observation(resource)
    }
}
impl TryFrom<Resource> for Observation {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Observation(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Observation).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Observation {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Observation(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Observation).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Observation {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Observation(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Observation).to_owned())),
        }
    }
}
impl From<OperationDefinition> for Resource {
    fn from(resource: OperationDefinition) -> Self {
        Self::OperationDefinition(resource)
    }
}
impl TryFrom<Resource> for OperationDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::OperationDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(OperationDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a OperationDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::OperationDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(OperationDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut OperationDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::OperationDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(OperationDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<OperationOutcome> for Resource {
    fn from(resource: OperationOutcome) -> Self {
        Self::OperationOutcome(resource)
    }
}
impl TryFrom<Resource> for OperationOutcome {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::OperationOutcome(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(OperationOutcome).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a OperationOutcome {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::OperationOutcome(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(OperationOutcome).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut OperationOutcome {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::OperationOutcome(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(OperationOutcome).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<Organization> for Resource {
    fn from(resource: Organization) -> Self {
        Self::Organization(resource)
    }
}
impl TryFrom<Resource> for Organization {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Organization(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Organization).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Organization {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Organization(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Organization).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Organization {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Organization(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Organization).to_owned())),
        }
    }
}
impl From<Parameters> for Resource {
    fn from(resource: Parameters) -> Self {
        Self::Parameters(resource)
    }
}
impl TryFrom<Resource> for Parameters {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Parameters(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Parameters).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Parameters {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Parameters(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Parameters).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Parameters {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Parameters(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Parameters).to_owned())),
        }
    }
}
impl From<Patient> for Resource {
    fn from(resource: Patient) -> Self {
        Self::Patient(resource)
    }
}
impl TryFrom<Resource> for Patient {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Patient(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Patient).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Patient {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Patient(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Patient).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Patient {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Patient(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Patient).to_owned())),
        }
    }
}
impl From<PaymentNotice> for Resource {
    fn from(resource: PaymentNotice) -> Self {
        Self::PaymentNotice(resource)
    }
}
impl TryFrom<Resource> for PaymentNotice {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::PaymentNotice(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(PaymentNotice).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a PaymentNotice {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::PaymentNotice(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(PaymentNotice).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut PaymentNotice {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::PaymentNotice(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(PaymentNotice).to_owned()))
            }
        }
    }
}
impl From<PaymentReconciliation> for Resource {
    fn from(resource: PaymentReconciliation) -> Self {
        Self::PaymentReconciliation(resource)
    }
}
impl TryFrom<Resource> for PaymentReconciliation {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::PaymentReconciliation(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(PaymentReconciliation).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a PaymentReconciliation {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::PaymentReconciliation(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(PaymentReconciliation).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut PaymentReconciliation {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::PaymentReconciliation(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(PaymentReconciliation).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<Person> for Resource {
    fn from(resource: Person) -> Self {
        Self::Person(resource)
    }
}
impl TryFrom<Resource> for Person {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Person(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Person).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Person {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Person(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Person).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Person {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Person(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Person).to_owned())),
        }
    }
}
impl From<PlanDefinition> for Resource {
    fn from(resource: PlanDefinition) -> Self {
        Self::PlanDefinition(resource)
    }
}
impl TryFrom<Resource> for PlanDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::PlanDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(PlanDefinition).to_owned()),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a PlanDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::PlanDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(PlanDefinition).to_owned()),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut PlanDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::PlanDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(PlanDefinition).to_owned()),
                )
            }
        }
    }
}
impl From<Practitioner> for Resource {
    fn from(resource: Practitioner) -> Self {
        Self::Practitioner(resource)
    }
}
impl TryFrom<Resource> for Practitioner {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Practitioner(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Practitioner).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Practitioner {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Practitioner(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Practitioner).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Practitioner {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Practitioner(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Practitioner).to_owned())),
        }
    }
}
impl From<PractitionerRole> for Resource {
    fn from(resource: PractitionerRole) -> Self {
        Self::PractitionerRole(resource)
    }
}
impl TryFrom<Resource> for PractitionerRole {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::PractitionerRole(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(PractitionerRole).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a PractitionerRole {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::PractitionerRole(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(PractitionerRole).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut PractitionerRole {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::PractitionerRole(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(PractitionerRole).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<Procedure> for Resource {
    fn from(resource: Procedure) -> Self {
        Self::Procedure(resource)
    }
}
impl TryFrom<Resource> for Procedure {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Procedure(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Procedure).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Procedure {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Procedure(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Procedure).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Procedure {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Procedure(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Procedure).to_owned())),
        }
    }
}
impl From<ProcedureRequest> for Resource {
    fn from(resource: ProcedureRequest) -> Self {
        Self::ProcedureRequest(resource)
    }
}
impl TryFrom<Resource> for ProcedureRequest {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ProcedureRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ProcedureRequest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ProcedureRequest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ProcedureRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ProcedureRequest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ProcedureRequest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ProcedureRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ProcedureRequest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<ProcessRequest> for Resource {
    fn from(resource: ProcessRequest) -> Self {
        Self::ProcessRequest(resource)
    }
}
impl TryFrom<Resource> for ProcessRequest {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ProcessRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(ProcessRequest).to_owned()),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ProcessRequest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ProcessRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(ProcessRequest).to_owned()),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ProcessRequest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ProcessRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(ProcessRequest).to_owned()),
                )
            }
        }
    }
}
impl From<ProcessResponse> for Resource {
    fn from(resource: ProcessResponse) -> Self {
        Self::ProcessResponse(resource)
    }
}
impl TryFrom<Resource> for ProcessResponse {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ProcessResponse(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ProcessResponse).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ProcessResponse {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ProcessResponse(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ProcessResponse).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ProcessResponse {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ProcessResponse(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ProcessResponse).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<Provenance> for Resource {
    fn from(resource: Provenance) -> Self {
        Self::Provenance(resource)
    }
}
impl TryFrom<Resource> for Provenance {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Provenance(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Provenance).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Provenance {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Provenance(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Provenance).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Provenance {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Provenance(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Provenance).to_owned())),
        }
    }
}
impl From<Questionnaire> for Resource {
    fn from(resource: Questionnaire) -> Self {
        Self::Questionnaire(resource)
    }
}
impl TryFrom<Resource> for Questionnaire {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Questionnaire(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(Questionnaire).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Questionnaire {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Questionnaire(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(Questionnaire).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Questionnaire {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Questionnaire(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(Questionnaire).to_owned()))
            }
        }
    }
}
impl From<QuestionnaireResponse> for Resource {
    fn from(resource: QuestionnaireResponse) -> Self {
        Self::QuestionnaireResponse(resource)
    }
}
impl TryFrom<Resource> for QuestionnaireResponse {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::QuestionnaireResponse(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(QuestionnaireResponse).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a QuestionnaireResponse {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::QuestionnaireResponse(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(QuestionnaireResponse).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut QuestionnaireResponse {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::QuestionnaireResponse(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(QuestionnaireResponse).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<ReferralRequest> for Resource {
    fn from(resource: ReferralRequest) -> Self {
        Self::ReferralRequest(resource)
    }
}
impl TryFrom<Resource> for ReferralRequest {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ReferralRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ReferralRequest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ReferralRequest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ReferralRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ReferralRequest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ReferralRequest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ReferralRequest(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ReferralRequest).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<RelatedPerson> for Resource {
    fn from(resource: RelatedPerson) -> Self {
        Self::RelatedPerson(resource)
    }
}
impl TryFrom<Resource> for RelatedPerson {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::RelatedPerson(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(RelatedPerson).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a RelatedPerson {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::RelatedPerson(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(RelatedPerson).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut RelatedPerson {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::RelatedPerson(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(RelatedPerson).to_owned()))
            }
        }
    }
}
impl From<RequestGroup> for Resource {
    fn from(resource: RequestGroup) -> Self {
        Self::RequestGroup(resource)
    }
}
impl TryFrom<Resource> for RequestGroup {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::RequestGroup(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(RequestGroup).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a RequestGroup {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::RequestGroup(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(RequestGroup).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut RequestGroup {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::RequestGroup(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(RequestGroup).to_owned())),
        }
    }
}
impl From<ResearchStudy> for Resource {
    fn from(resource: ResearchStudy) -> Self {
        Self::ResearchStudy(resource)
    }
}
impl TryFrom<Resource> for ResearchStudy {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ResearchStudy(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(ResearchStudy).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ResearchStudy {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ResearchStudy(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(ResearchStudy).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ResearchStudy {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ResearchStudy(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(ResearchStudy).to_owned()))
            }
        }
    }
}
impl From<ResearchSubject> for Resource {
    fn from(resource: ResearchSubject) -> Self {
        Self::ResearchSubject(resource)
    }
}
impl TryFrom<Resource> for ResearchSubject {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ResearchSubject(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ResearchSubject).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ResearchSubject {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ResearchSubject(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ResearchSubject).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ResearchSubject {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ResearchSubject(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ResearchSubject).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<RiskAssessment> for Resource {
    fn from(resource: RiskAssessment) -> Self {
        Self::RiskAssessment(resource)
    }
}
impl TryFrom<Resource> for RiskAssessment {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::RiskAssessment(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(RiskAssessment).to_owned()),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a RiskAssessment {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::RiskAssessment(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(RiskAssessment).to_owned()),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut RiskAssessment {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::RiskAssessment(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(RiskAssessment).to_owned()),
                )
            }
        }
    }
}
impl From<Schedule> for Resource {
    fn from(resource: Schedule) -> Self {
        Self::Schedule(resource)
    }
}
impl TryFrom<Resource> for Schedule {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Schedule(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Schedule).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Schedule {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Schedule(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Schedule).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Schedule {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Schedule(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Schedule).to_owned())),
        }
    }
}
impl From<SearchParameter> for Resource {
    fn from(resource: SearchParameter) -> Self {
        Self::SearchParameter(resource)
    }
}
impl TryFrom<Resource> for SearchParameter {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SearchParameter(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SearchParameter).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a SearchParameter {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SearchParameter(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SearchParameter).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut SearchParameter {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SearchParameter(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(SearchParameter).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<Sequence> for Resource {
    fn from(resource: Sequence) -> Self {
        Self::Sequence(resource)
    }
}
impl TryFrom<Resource> for Sequence {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Sequence(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Sequence).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Sequence {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Sequence(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Sequence).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Sequence {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Sequence(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Sequence).to_owned())),
        }
    }
}
impl From<ServiceDefinition> for Resource {
    fn from(resource: ServiceDefinition) -> Self {
        Self::ServiceDefinition(resource)
    }
}
impl TryFrom<Resource> for ServiceDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ServiceDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ServiceDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ServiceDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ServiceDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ServiceDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ServiceDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ServiceDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(ServiceDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<Slot> for Resource {
    fn from(resource: Slot) -> Self {
        Self::Slot(resource)
    }
}
impl TryFrom<Resource> for Slot {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Slot(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Slot).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Slot {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Slot(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Slot).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Slot {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Slot(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Slot).to_owned())),
        }
    }
}
impl From<Specimen> for Resource {
    fn from(resource: Specimen) -> Self {
        Self::Specimen(resource)
    }
}
impl TryFrom<Resource> for Specimen {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Specimen(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Specimen).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Specimen {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Specimen(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Specimen).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Specimen {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Specimen(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Specimen).to_owned())),
        }
    }
}
impl From<StructureDefinition> for Resource {
    fn from(resource: StructureDefinition) -> Self {
        Self::StructureDefinition(resource)
    }
}
impl TryFrom<Resource> for StructureDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::StructureDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(StructureDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a StructureDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::StructureDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(StructureDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut StructureDefinition {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::StructureDefinition(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(StructureDefinition).to_owned(),
                    ),
                )
            }
        }
    }
}
impl From<StructureMap> for Resource {
    fn from(resource: StructureMap) -> Self {
        Self::StructureMap(resource)
    }
}
impl TryFrom<Resource> for StructureMap {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::StructureMap(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(StructureMap).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a StructureMap {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::StructureMap(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(StructureMap).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut StructureMap {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::StructureMap(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(StructureMap).to_owned())),
        }
    }
}
impl From<Subscription> for Resource {
    fn from(resource: Subscription) -> Self {
        Self::Subscription(resource)
    }
}
impl TryFrom<Resource> for Subscription {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Subscription(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Subscription).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Subscription {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Subscription(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Subscription).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Subscription {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Subscription(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Subscription).to_owned())),
        }
    }
}
impl From<Substance> for Resource {
    fn from(resource: Substance) -> Self {
        Self::Substance(resource)
    }
}
impl TryFrom<Resource> for Substance {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Substance(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Substance).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Substance {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Substance(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Substance).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Substance {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Substance(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Substance).to_owned())),
        }
    }
}
impl From<SupplyDelivery> for Resource {
    fn from(resource: SupplyDelivery) -> Self {
        Self::SupplyDelivery(resource)
    }
}
impl TryFrom<Resource> for SupplyDelivery {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SupplyDelivery(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(SupplyDelivery).to_owned()),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a SupplyDelivery {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SupplyDelivery(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(SupplyDelivery).to_owned()),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut SupplyDelivery {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SupplyDelivery(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(actual_type, stringify!(SupplyDelivery).to_owned()),
                )
            }
        }
    }
}
impl From<SupplyRequest> for Resource {
    fn from(resource: SupplyRequest) -> Self {
        Self::SupplyRequest(resource)
    }
}
impl TryFrom<Resource> for SupplyRequest {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SupplyRequest(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(SupplyRequest).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a SupplyRequest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SupplyRequest(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(SupplyRequest).to_owned()))
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut SupplyRequest {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::SupplyRequest(r) => Ok(r),
            _ => {
                Err(WrongResourceType(actual_type, stringify!(SupplyRequest).to_owned()))
            }
        }
    }
}
impl From<Task> for Resource {
    fn from(resource: Task) -> Self {
        Self::Task(resource)
    }
}
impl TryFrom<Resource> for Task {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Task(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Task).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a Task {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Task(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Task).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut Task {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::Task(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(Task).to_owned())),
        }
    }
}
impl From<TestReport> for Resource {
    fn from(resource: TestReport) -> Self {
        Self::TestReport(resource)
    }
}
impl TryFrom<Resource> for TestReport {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::TestReport(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(TestReport).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a TestReport {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::TestReport(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(TestReport).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut TestReport {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::TestReport(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(TestReport).to_owned())),
        }
    }
}
impl From<TestScript> for Resource {
    fn from(resource: TestScript) -> Self {
        Self::TestScript(resource)
    }
}
impl TryFrom<Resource> for TestScript {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::TestScript(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(TestScript).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a TestScript {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::TestScript(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(TestScript).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut TestScript {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::TestScript(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(TestScript).to_owned())),
        }
    }
}
impl From<ValueSet> for Resource {
    fn from(resource: ValueSet) -> Self {
        Self::ValueSet(resource)
    }
}
impl TryFrom<Resource> for ValueSet {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ValueSet(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(ValueSet).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a ValueSet {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ValueSet(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(ValueSet).to_owned())),
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut ValueSet {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::ValueSet(r) => Ok(r),
            _ => Err(WrongResourceType(actual_type, stringify!(ValueSet).to_owned())),
        }
    }
}
impl From<VisionPrescription> for Resource {
    fn from(resource: VisionPrescription) -> Self {
        Self::VisionPrescription(resource)
    }
}
impl TryFrom<Resource> for VisionPrescription {
    type Error = WrongResourceType;
    fn try_from(resource: Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::VisionPrescription(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(VisionPrescription).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a Resource> for &'a VisionPrescription {
    type Error = WrongResourceType;
    fn try_from(resource: &'a Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::VisionPrescription(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(VisionPrescription).to_owned(),
                    ),
                )
            }
        }
    }
}
impl<'a> TryFrom<&'a mut Resource> for &'a mut VisionPrescription {
    type Error = WrongResourceType;
    fn try_from(resource: &'a mut Resource) -> Result<Self, Self::Error> {
        let actual_type = resource.resource_type().to_string();
        match resource {
            Resource::VisionPrescription(r) => Ok(r),
            _ => {
                Err(
                    WrongResourceType(
                        actual_type,
                        stringify!(VisionPrescription).to_owned(),
                    ),
                )
            }
        }
    }
}
impl Resource {
    /// Get the resource type of the resource.
    #[must_use]
    pub const fn resource_type(&self) -> ResourceType {
        match self {
            Self::Account(_) => ResourceType::Account,
            Self::ActivityDefinition(_) => ResourceType::ActivityDefinition,
            Self::AdverseEvent(_) => ResourceType::AdverseEvent,
            Self::AllergyIntolerance(_) => ResourceType::AllergyIntolerance,
            Self::Appointment(_) => ResourceType::Appointment,
            Self::AppointmentResponse(_) => ResourceType::AppointmentResponse,
            Self::AuditEvent(_) => ResourceType::AuditEvent,
            Self::Basic(_) => ResourceType::Basic,
            Self::Binary(_) => ResourceType::Binary,
            Self::BodySite(_) => ResourceType::BodySite,
            Self::Bundle(_) => ResourceType::Bundle,
            Self::CapabilityStatement(_) => ResourceType::CapabilityStatement,
            Self::CarePlan(_) => ResourceType::CarePlan,
            Self::CareTeam(_) => ResourceType::CareTeam,
            Self::ChargeItem(_) => ResourceType::ChargeItem,
            Self::Claim(_) => ResourceType::Claim,
            Self::ClaimResponse(_) => ResourceType::ClaimResponse,
            Self::ClinicalImpression(_) => ResourceType::ClinicalImpression,
            Self::CodeSystem(_) => ResourceType::CodeSystem,
            Self::Communication(_) => ResourceType::Communication,
            Self::CommunicationRequest(_) => ResourceType::CommunicationRequest,
            Self::CompartmentDefinition(_) => ResourceType::CompartmentDefinition,
            Self::Composition(_) => ResourceType::Composition,
            Self::ConceptMap(_) => ResourceType::ConceptMap,
            Self::Condition(_) => ResourceType::Condition,
            Self::Consent(_) => ResourceType::Consent,
            Self::Contract(_) => ResourceType::Contract,
            Self::Coverage(_) => ResourceType::Coverage,
            Self::DataElement(_) => ResourceType::DataElement,
            Self::DetectedIssue(_) => ResourceType::DetectedIssue,
            Self::Device(_) => ResourceType::Device,
            Self::DeviceComponent(_) => ResourceType::DeviceComponent,
            Self::DeviceMetric(_) => ResourceType::DeviceMetric,
            Self::DeviceRequest(_) => ResourceType::DeviceRequest,
            Self::DeviceUseStatement(_) => ResourceType::DeviceUseStatement,
            Self::DiagnosticReport(_) => ResourceType::DiagnosticReport,
            Self::DocumentManifest(_) => ResourceType::DocumentManifest,
            Self::DocumentReference(_) => ResourceType::DocumentReference,
            Self::EligibilityRequest(_) => ResourceType::EligibilityRequest,
            Self::EligibilityResponse(_) => ResourceType::EligibilityResponse,
            Self::Encounter(_) => ResourceType::Encounter,
            Self::Endpoint(_) => ResourceType::Endpoint,
            Self::EnrollmentRequest(_) => ResourceType::EnrollmentRequest,
            Self::EnrollmentResponse(_) => ResourceType::EnrollmentResponse,
            Self::EpisodeOfCare(_) => ResourceType::EpisodeOfCare,
            Self::ExpansionProfile(_) => ResourceType::ExpansionProfile,
            Self::ExplanationOfBenefit(_) => ResourceType::ExplanationOfBenefit,
            Self::FamilyMemberHistory(_) => ResourceType::FamilyMemberHistory,
            Self::Flag(_) => ResourceType::Flag,
            Self::Goal(_) => ResourceType::Goal,
            Self::GraphDefinition(_) => ResourceType::GraphDefinition,
            Self::Group(_) => ResourceType::Group,
            Self::GuidanceResponse(_) => ResourceType::GuidanceResponse,
            Self::HealthcareService(_) => ResourceType::HealthcareService,
            Self::ImagingManifest(_) => ResourceType::ImagingManifest,
            Self::ImagingStudy(_) => ResourceType::ImagingStudy,
            Self::Immunization(_) => ResourceType::Immunization,
            Self::ImmunizationRecommendation(_) => {
                ResourceType::ImmunizationRecommendation
            }
            Self::ImplementationGuide(_) => ResourceType::ImplementationGuide,
            Self::Library(_) => ResourceType::Library,
            Self::Linkage(_) => ResourceType::Linkage,
            Self::List(_) => ResourceType::List,
            Self::Location(_) => ResourceType::Location,
            Self::Measure(_) => ResourceType::Measure,
            Self::MeasureReport(_) => ResourceType::MeasureReport,
            Self::Media(_) => ResourceType::Media,
            Self::Medication(_) => ResourceType::Medication,
            Self::MedicationAdministration(_) => ResourceType::MedicationAdministration,
            Self::MedicationDispense(_) => ResourceType::MedicationDispense,
            Self::MedicationRequest(_) => ResourceType::MedicationRequest,
            Self::MedicationStatement(_) => ResourceType::MedicationStatement,
            Self::MessageDefinition(_) => ResourceType::MessageDefinition,
            Self::MessageHeader(_) => ResourceType::MessageHeader,
            Self::NamingSystem(_) => ResourceType::NamingSystem,
            Self::NutritionOrder(_) => ResourceType::NutritionOrder,
            Self::Observation(_) => ResourceType::Observation,
            Self::OperationDefinition(_) => ResourceType::OperationDefinition,
            Self::OperationOutcome(_) => ResourceType::OperationOutcome,
            Self::Organization(_) => ResourceType::Organization,
            Self::Parameters(_) => ResourceType::Parameters,
            Self::Patient(_) => ResourceType::Patient,
            Self::PaymentNotice(_) => ResourceType::PaymentNotice,
            Self::PaymentReconciliation(_) => ResourceType::PaymentReconciliation,
            Self::Person(_) => ResourceType::Person,
            Self::PlanDefinition(_) => ResourceType::PlanDefinition,
            Self::Practitioner(_) => ResourceType::Practitioner,
            Self::PractitionerRole(_) => ResourceType::PractitionerRole,
            Self::Procedure(_) => ResourceType::Procedure,
            Self::ProcedureRequest(_) => ResourceType::ProcedureRequest,
            Self::ProcessRequest(_) => ResourceType::ProcessRequest,
            Self::ProcessResponse(_) => ResourceType::ProcessResponse,
            Self::Provenance(_) => ResourceType::Provenance,
            Self::Questionnaire(_) => ResourceType::Questionnaire,
            Self::QuestionnaireResponse(_) => ResourceType::QuestionnaireResponse,
            Self::ReferralRequest(_) => ResourceType::ReferralRequest,
            Self::RelatedPerson(_) => ResourceType::RelatedPerson,
            Self::RequestGroup(_) => ResourceType::RequestGroup,
            Self::ResearchStudy(_) => ResourceType::ResearchStudy,
            Self::ResearchSubject(_) => ResourceType::ResearchSubject,
            Self::RiskAssessment(_) => ResourceType::RiskAssessment,
            Self::Schedule(_) => ResourceType::Schedule,
            Self::SearchParameter(_) => ResourceType::SearchParameter,
            Self::Sequence(_) => ResourceType::Sequence,
            Self::ServiceDefinition(_) => ResourceType::ServiceDefinition,
            Self::Slot(_) => ResourceType::Slot,
            Self::Specimen(_) => ResourceType::Specimen,
            Self::StructureDefinition(_) => ResourceType::StructureDefinition,
            Self::StructureMap(_) => ResourceType::StructureMap,
            Self::Subscription(_) => ResourceType::Subscription,
            Self::Substance(_) => ResourceType::Substance,
            Self::SupplyDelivery(_) => ResourceType::SupplyDelivery,
            Self::SupplyRequest(_) => ResourceType::SupplyRequest,
            Self::Task(_) => ResourceType::Task,
            Self::TestReport(_) => ResourceType::TestReport,
            Self::TestScript(_) => ResourceType::TestScript,
            Self::ValueSet(_) => ResourceType::ValueSet,
            Self::VisionPrescription(_) => ResourceType::VisionPrescription,
        }
    }
}
impl ResourceType {
    /// Get the resource type as str.
    #[must_use]
    pub const fn as_str(&self) -> &'static str {
        match self {
            Self::Account => stringify!(Account),
            Self::ActivityDefinition => stringify!(ActivityDefinition),
            Self::AdverseEvent => stringify!(AdverseEvent),
            Self::AllergyIntolerance => stringify!(AllergyIntolerance),
            Self::Appointment => stringify!(Appointment),
            Self::AppointmentResponse => stringify!(AppointmentResponse),
            Self::AuditEvent => stringify!(AuditEvent),
            Self::Basic => stringify!(Basic),
            Self::Binary => stringify!(Binary),
            Self::BodySite => stringify!(BodySite),
            Self::Bundle => stringify!(Bundle),
            Self::CapabilityStatement => stringify!(CapabilityStatement),
            Self::CarePlan => stringify!(CarePlan),
            Self::CareTeam => stringify!(CareTeam),
            Self::ChargeItem => stringify!(ChargeItem),
            Self::Claim => stringify!(Claim),
            Self::ClaimResponse => stringify!(ClaimResponse),
            Self::ClinicalImpression => stringify!(ClinicalImpression),
            Self::CodeSystem => stringify!(CodeSystem),
            Self::Communication => stringify!(Communication),
            Self::CommunicationRequest => stringify!(CommunicationRequest),
            Self::CompartmentDefinition => stringify!(CompartmentDefinition),
            Self::Composition => stringify!(Composition),
            Self::ConceptMap => stringify!(ConceptMap),
            Self::Condition => stringify!(Condition),
            Self::Consent => stringify!(Consent),
            Self::Contract => stringify!(Contract),
            Self::Coverage => stringify!(Coverage),
            Self::DataElement => stringify!(DataElement),
            Self::DetectedIssue => stringify!(DetectedIssue),
            Self::Device => stringify!(Device),
            Self::DeviceComponent => stringify!(DeviceComponent),
            Self::DeviceMetric => stringify!(DeviceMetric),
            Self::DeviceRequest => stringify!(DeviceRequest),
            Self::DeviceUseStatement => stringify!(DeviceUseStatement),
            Self::DiagnosticReport => stringify!(DiagnosticReport),
            Self::DocumentManifest => stringify!(DocumentManifest),
            Self::DocumentReference => stringify!(DocumentReference),
            Self::EligibilityRequest => stringify!(EligibilityRequest),
            Self::EligibilityResponse => stringify!(EligibilityResponse),
            Self::Encounter => stringify!(Encounter),
            Self::Endpoint => stringify!(Endpoint),
            Self::EnrollmentRequest => stringify!(EnrollmentRequest),
            Self::EnrollmentResponse => stringify!(EnrollmentResponse),
            Self::EpisodeOfCare => stringify!(EpisodeOfCare),
            Self::ExpansionProfile => stringify!(ExpansionProfile),
            Self::ExplanationOfBenefit => stringify!(ExplanationOfBenefit),
            Self::FamilyMemberHistory => stringify!(FamilyMemberHistory),
            Self::Flag => stringify!(Flag),
            Self::Goal => stringify!(Goal),
            Self::GraphDefinition => stringify!(GraphDefinition),
            Self::Group => stringify!(Group),
            Self::GuidanceResponse => stringify!(GuidanceResponse),
            Self::HealthcareService => stringify!(HealthcareService),
            Self::ImagingManifest => stringify!(ImagingManifest),
            Self::ImagingStudy => stringify!(ImagingStudy),
            Self::Immunization => stringify!(Immunization),
            Self::ImmunizationRecommendation => stringify!(ImmunizationRecommendation),
            Self::ImplementationGuide => stringify!(ImplementationGuide),
            Self::Library => stringify!(Library),
            Self::Linkage => stringify!(Linkage),
            Self::List => stringify!(List),
            Self::Location => stringify!(Location),
            Self::Measure => stringify!(Measure),
            Self::MeasureReport => stringify!(MeasureReport),
            Self::Media => stringify!(Media),
            Self::Medication => stringify!(Medication),
            Self::MedicationAdministration => stringify!(MedicationAdministration),
            Self::MedicationDispense => stringify!(MedicationDispense),
            Self::MedicationRequest => stringify!(MedicationRequest),
            Self::MedicationStatement => stringify!(MedicationStatement),
            Self::MessageDefinition => stringify!(MessageDefinition),
            Self::MessageHeader => stringify!(MessageHeader),
            Self::NamingSystem => stringify!(NamingSystem),
            Self::NutritionOrder => stringify!(NutritionOrder),
            Self::Observation => stringify!(Observation),
            Self::OperationDefinition => stringify!(OperationDefinition),
            Self::OperationOutcome => stringify!(OperationOutcome),
            Self::Organization => stringify!(Organization),
            Self::Parameters => stringify!(Parameters),
            Self::Patient => stringify!(Patient),
            Self::PaymentNotice => stringify!(PaymentNotice),
            Self::PaymentReconciliation => stringify!(PaymentReconciliation),
            Self::Person => stringify!(Person),
            Self::PlanDefinition => stringify!(PlanDefinition),
            Self::Practitioner => stringify!(Practitioner),
            Self::PractitionerRole => stringify!(PractitionerRole),
            Self::Procedure => stringify!(Procedure),
            Self::ProcedureRequest => stringify!(ProcedureRequest),
            Self::ProcessRequest => stringify!(ProcessRequest),
            Self::ProcessResponse => stringify!(ProcessResponse),
            Self::Provenance => stringify!(Provenance),
            Self::Questionnaire => stringify!(Questionnaire),
            Self::QuestionnaireResponse => stringify!(QuestionnaireResponse),
            Self::ReferralRequest => stringify!(ReferralRequest),
            Self::RelatedPerson => stringify!(RelatedPerson),
            Self::RequestGroup => stringify!(RequestGroup),
            Self::ResearchStudy => stringify!(ResearchStudy),
            Self::ResearchSubject => stringify!(ResearchSubject),
            Self::RiskAssessment => stringify!(RiskAssessment),
            Self::Schedule => stringify!(Schedule),
            Self::SearchParameter => stringify!(SearchParameter),
            Self::Sequence => stringify!(Sequence),
            Self::ServiceDefinition => stringify!(ServiceDefinition),
            Self::Slot => stringify!(Slot),
            Self::Specimen => stringify!(Specimen),
            Self::StructureDefinition => stringify!(StructureDefinition),
            Self::StructureMap => stringify!(StructureMap),
            Self::Subscription => stringify!(Subscription),
            Self::Substance => stringify!(Substance),
            Self::SupplyDelivery => stringify!(SupplyDelivery),
            Self::SupplyRequest => stringify!(SupplyRequest),
            Self::Task => stringify!(Task),
            Self::TestReport => stringify!(TestReport),
            Self::TestScript => stringify!(TestScript),
            Self::ValueSet => stringify!(ValueSet),
            Self::VisionPrescription => stringify!(VisionPrescription),
        }
    }
}
impl std::str::FromStr for ResourceType {
    type Err = String;
    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s {
            stringify!(Account) => Ok(Self::Account),
            stringify!(ActivityDefinition) => Ok(Self::ActivityDefinition),
            stringify!(AdverseEvent) => Ok(Self::AdverseEvent),
            stringify!(AllergyIntolerance) => Ok(Self::AllergyIntolerance),
            stringify!(Appointment) => Ok(Self::Appointment),
            stringify!(AppointmentResponse) => Ok(Self::AppointmentResponse),
            stringify!(AuditEvent) => Ok(Self::AuditEvent),
            stringify!(Basic) => Ok(Self::Basic),
            stringify!(Binary) => Ok(Self::Binary),
            stringify!(BodySite) => Ok(Self::BodySite),
            stringify!(Bundle) => Ok(Self::Bundle),
            stringify!(CapabilityStatement) => Ok(Self::CapabilityStatement),
            stringify!(CarePlan) => Ok(Self::CarePlan),
            stringify!(CareTeam) => Ok(Self::CareTeam),
            stringify!(ChargeItem) => Ok(Self::ChargeItem),
            stringify!(Claim) => Ok(Self::Claim),
            stringify!(ClaimResponse) => Ok(Self::ClaimResponse),
            stringify!(ClinicalImpression) => Ok(Self::ClinicalImpression),
            stringify!(CodeSystem) => Ok(Self::CodeSystem),
            stringify!(Communication) => Ok(Self::Communication),
            stringify!(CommunicationRequest) => Ok(Self::CommunicationRequest),
            stringify!(CompartmentDefinition) => Ok(Self::CompartmentDefinition),
            stringify!(Composition) => Ok(Self::Composition),
            stringify!(ConceptMap) => Ok(Self::ConceptMap),
            stringify!(Condition) => Ok(Self::Condition),
            stringify!(Consent) => Ok(Self::Consent),
            stringify!(Contract) => Ok(Self::Contract),
            stringify!(Coverage) => Ok(Self::Coverage),
            stringify!(DataElement) => Ok(Self::DataElement),
            stringify!(DetectedIssue) => Ok(Self::DetectedIssue),
            stringify!(Device) => Ok(Self::Device),
            stringify!(DeviceComponent) => Ok(Self::DeviceComponent),
            stringify!(DeviceMetric) => Ok(Self::DeviceMetric),
            stringify!(DeviceRequest) => Ok(Self::DeviceRequest),
            stringify!(DeviceUseStatement) => Ok(Self::DeviceUseStatement),
            stringify!(DiagnosticReport) => Ok(Self::DiagnosticReport),
            stringify!(DocumentManifest) => Ok(Self::DocumentManifest),
            stringify!(DocumentReference) => Ok(Self::DocumentReference),
            stringify!(EligibilityRequest) => Ok(Self::EligibilityRequest),
            stringify!(EligibilityResponse) => Ok(Self::EligibilityResponse),
            stringify!(Encounter) => Ok(Self::Encounter),
            stringify!(Endpoint) => Ok(Self::Endpoint),
            stringify!(EnrollmentRequest) => Ok(Self::EnrollmentRequest),
            stringify!(EnrollmentResponse) => Ok(Self::EnrollmentResponse),
            stringify!(EpisodeOfCare) => Ok(Self::EpisodeOfCare),
            stringify!(ExpansionProfile) => Ok(Self::ExpansionProfile),
            stringify!(ExplanationOfBenefit) => Ok(Self::ExplanationOfBenefit),
            stringify!(FamilyMemberHistory) => Ok(Self::FamilyMemberHistory),
            stringify!(Flag) => Ok(Self::Flag),
            stringify!(Goal) => Ok(Self::Goal),
            stringify!(GraphDefinition) => Ok(Self::GraphDefinition),
            stringify!(Group) => Ok(Self::Group),
            stringify!(GuidanceResponse) => Ok(Self::GuidanceResponse),
            stringify!(HealthcareService) => Ok(Self::HealthcareService),
            stringify!(ImagingManifest) => Ok(Self::ImagingManifest),
            stringify!(ImagingStudy) => Ok(Self::ImagingStudy),
            stringify!(Immunization) => Ok(Self::Immunization),
            stringify!(ImmunizationRecommendation) => {
                Ok(Self::ImmunizationRecommendation)
            }
            stringify!(ImplementationGuide) => Ok(Self::ImplementationGuide),
            stringify!(Library) => Ok(Self::Library),
            stringify!(Linkage) => Ok(Self::Linkage),
            stringify!(List) => Ok(Self::List),
            stringify!(Location) => Ok(Self::Location),
            stringify!(Measure) => Ok(Self::Measure),
            stringify!(MeasureReport) => Ok(Self::MeasureReport),
            stringify!(Media) => Ok(Self::Media),
            stringify!(Medication) => Ok(Self::Medication),
            stringify!(MedicationAdministration) => Ok(Self::MedicationAdministration),
            stringify!(MedicationDispense) => Ok(Self::MedicationDispense),
            stringify!(MedicationRequest) => Ok(Self::MedicationRequest),
            stringify!(MedicationStatement) => Ok(Self::MedicationStatement),
            stringify!(MessageDefinition) => Ok(Self::MessageDefinition),
            stringify!(MessageHeader) => Ok(Self::MessageHeader),
            stringify!(NamingSystem) => Ok(Self::NamingSystem),
            stringify!(NutritionOrder) => Ok(Self::NutritionOrder),
            stringify!(Observation) => Ok(Self::Observation),
            stringify!(OperationDefinition) => Ok(Self::OperationDefinition),
            stringify!(OperationOutcome) => Ok(Self::OperationOutcome),
            stringify!(Organization) => Ok(Self::Organization),
            stringify!(Parameters) => Ok(Self::Parameters),
            stringify!(Patient) => Ok(Self::Patient),
            stringify!(PaymentNotice) => Ok(Self::PaymentNotice),
            stringify!(PaymentReconciliation) => Ok(Self::PaymentReconciliation),
            stringify!(Person) => Ok(Self::Person),
            stringify!(PlanDefinition) => Ok(Self::PlanDefinition),
            stringify!(Practitioner) => Ok(Self::Practitioner),
            stringify!(PractitionerRole) => Ok(Self::PractitionerRole),
            stringify!(Procedure) => Ok(Self::Procedure),
            stringify!(ProcedureRequest) => Ok(Self::ProcedureRequest),
            stringify!(ProcessRequest) => Ok(Self::ProcessRequest),
            stringify!(ProcessResponse) => Ok(Self::ProcessResponse),
            stringify!(Provenance) => Ok(Self::Provenance),
            stringify!(Questionnaire) => Ok(Self::Questionnaire),
            stringify!(QuestionnaireResponse) => Ok(Self::QuestionnaireResponse),
            stringify!(ReferralRequest) => Ok(Self::ReferralRequest),
            stringify!(RelatedPerson) => Ok(Self::RelatedPerson),
            stringify!(RequestGroup) => Ok(Self::RequestGroup),
            stringify!(ResearchStudy) => Ok(Self::ResearchStudy),
            stringify!(ResearchSubject) => Ok(Self::ResearchSubject),
            stringify!(RiskAssessment) => Ok(Self::RiskAssessment),
            stringify!(Schedule) => Ok(Self::Schedule),
            stringify!(SearchParameter) => Ok(Self::SearchParameter),
            stringify!(Sequence) => Ok(Self::Sequence),
            stringify!(ServiceDefinition) => Ok(Self::ServiceDefinition),
            stringify!(Slot) => Ok(Self::Slot),
            stringify!(Specimen) => Ok(Self::Specimen),
            stringify!(StructureDefinition) => Ok(Self::StructureDefinition),
            stringify!(StructureMap) => Ok(Self::StructureMap),
            stringify!(Subscription) => Ok(Self::Subscription),
            stringify!(Substance) => Ok(Self::Substance),
            stringify!(SupplyDelivery) => Ok(Self::SupplyDelivery),
            stringify!(SupplyRequest) => Ok(Self::SupplyRequest),
            stringify!(Task) => Ok(Self::Task),
            stringify!(TestReport) => Ok(Self::TestReport),
            stringify!(TestScript) => Ok(Self::TestScript),
            stringify!(ValueSet) => Ok(Self::ValueSet),
            stringify!(VisionPrescription) => Ok(Self::VisionPrescription),
            _ => Err(format!("Unknown value: {s}")),
        }
    }
}
/** Base StructureDefinition for Resource Resource

 **Resource v3.0.2**

 Base Resource

 This is the base resource type for everything.

 */
pub trait BaseResource {
    #[doc = concat!("Get `", stringify!(id), "`.")]
    fn id(&self) -> &Option<String>;
    #[doc = concat!("Get `", stringify!(id), "` mutably.")]
    fn id_mut(&mut self) -> &mut Option<String>;
    #[doc = concat!("Set `", stringify!(id), "`.")]
    fn set_id(&mut self, value: Option<String>);
    #[doc = concat!("Get `", stringify!(meta), "`.")]
    fn meta(&self) -> &Option<Meta>;
    #[doc = concat!("Get `", stringify!(meta), "` mutably.")]
    fn meta_mut(&mut self) -> &mut Option<Meta>;
    #[doc = concat!("Set `", stringify!(meta), "`.")]
    fn set_meta(&mut self, value: Option<Meta>);
    #[doc = concat!("Get `", stringify!(implicit_rules), "`.")]
    fn implicit_rules(&self) -> &Option<String>;
    #[doc = concat!("Get `", stringify!(implicit_rules), "` mutably.")]
    fn implicit_rules_mut(&mut self) -> &mut Option<String>;
    #[doc = concat!("Set `", stringify!(implicit_rules), "`.")]
    fn set_implicit_rules(&mut self, value: Option<String>);
    #[doc = concat!("Get `", stringify!(language), "`.")]
    fn language(&self) -> &Option<String>;
    #[doc = concat!("Get `", stringify!(language), "` mutably.")]
    fn language_mut(&mut self) -> &mut Option<String>;
    #[doc = concat!("Set `", stringify!(language), "`.")]
    fn set_language(&mut self, value: Option<String>);
}
impl BaseResource for Account {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for ActivityDefinition {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for AdverseEvent {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for AllergyIntolerance {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Appointment {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for AppointmentResponse {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for AuditEvent {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Basic {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Binary {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for BodySite {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Bundle {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for CapabilityStatement {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for CarePlan {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for CareTeam {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for ChargeItem {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Claim {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for ClaimResponse {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for ClinicalImpression {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for CodeSystem {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Communication {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for CommunicationRequest {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for CompartmentDefinition {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Composition {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for ConceptMap {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Condition {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Consent {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Contract {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Coverage {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for DataElement {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for DetectedIssue {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Device {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for DeviceComponent {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for DeviceMetric {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for DeviceRequest {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for DeviceUseStatement {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for DiagnosticReport {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for DocumentManifest {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for DocumentReference {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for EligibilityRequest {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for EligibilityResponse {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Encounter {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Endpoint {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for EnrollmentRequest {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for EnrollmentResponse {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for EpisodeOfCare {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for ExpansionProfile {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for ExplanationOfBenefit {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for FamilyMemberHistory {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Flag {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Goal {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for GraphDefinition {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Group {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for GuidanceResponse {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for HealthcareService {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for ImagingManifest {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for ImagingStudy {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Immunization {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for ImmunizationRecommendation {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for ImplementationGuide {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Library {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Linkage {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for List {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Location {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Measure {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for MeasureReport {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Media {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Medication {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for MedicationAdministration {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for MedicationDispense {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for MedicationRequest {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for MedicationStatement {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for MessageDefinition {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for MessageHeader {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for NamingSystem {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for NutritionOrder {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Observation {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for OperationDefinition {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for OperationOutcome {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Organization {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Parameters {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Patient {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for PaymentNotice {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for PaymentReconciliation {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Person {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for PlanDefinition {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Practitioner {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for PractitionerRole {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Procedure {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for ProcedureRequest {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for ProcessRequest {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for ProcessResponse {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Provenance {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Questionnaire {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for QuestionnaireResponse {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for ReferralRequest {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for RelatedPerson {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for RequestGroup {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for ResearchStudy {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for ResearchSubject {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for RiskAssessment {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Schedule {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for SearchParameter {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Sequence {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for ServiceDefinition {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Slot {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Specimen {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for StructureDefinition {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for StructureMap {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Subscription {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Substance {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for SupplyDelivery {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for SupplyRequest {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for Task {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for TestReport {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for TestScript {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for ValueSet {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl BaseResource for VisionPrescription {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
}
impl Resource {
    /// Return the resource as base resource.
    #[must_use]
    #[inline]
    pub fn as_base_resource(&self) -> &dyn BaseResource {
        match self {
            Self::Account(r) => r,
            Self::ActivityDefinition(r) => r,
            Self::AdverseEvent(r) => r,
            Self::AllergyIntolerance(r) => r,
            Self::Appointment(r) => r,
            Self::AppointmentResponse(r) => r,
            Self::AuditEvent(r) => r,
            Self::Basic(r) => r,
            Self::Binary(r) => r,
            Self::BodySite(r) => r,
            Self::Bundle(r) => r,
            Self::CapabilityStatement(r) => r,
            Self::CarePlan(r) => r,
            Self::CareTeam(r) => r,
            Self::ChargeItem(r) => r,
            Self::Claim(r) => r,
            Self::ClaimResponse(r) => r,
            Self::ClinicalImpression(r) => r,
            Self::CodeSystem(r) => r,
            Self::Communication(r) => r,
            Self::CommunicationRequest(r) => r,
            Self::CompartmentDefinition(r) => r,
            Self::Composition(r) => r,
            Self::ConceptMap(r) => r,
            Self::Condition(r) => r,
            Self::Consent(r) => r,
            Self::Contract(r) => r,
            Self::Coverage(r) => r,
            Self::DataElement(r) => r,
            Self::DetectedIssue(r) => r,
            Self::Device(r) => r,
            Self::DeviceComponent(r) => r,
            Self::DeviceMetric(r) => r,
            Self::DeviceRequest(r) => r,
            Self::DeviceUseStatement(r) => r,
            Self::DiagnosticReport(r) => r,
            Self::DocumentManifest(r) => r,
            Self::DocumentReference(r) => r,
            Self::EligibilityRequest(r) => r,
            Self::EligibilityResponse(r) => r,
            Self::Encounter(r) => r,
            Self::Endpoint(r) => r,
            Self::EnrollmentRequest(r) => r,
            Self::EnrollmentResponse(r) => r,
            Self::EpisodeOfCare(r) => r,
            Self::ExpansionProfile(r) => r,
            Self::ExplanationOfBenefit(r) => r,
            Self::FamilyMemberHistory(r) => r,
            Self::Flag(r) => r,
            Self::Goal(r) => r,
            Self::GraphDefinition(r) => r,
            Self::Group(r) => r,
            Self::GuidanceResponse(r) => r,
            Self::HealthcareService(r) => r,
            Self::ImagingManifest(r) => r,
            Self::ImagingStudy(r) => r,
            Self::Immunization(r) => r,
            Self::ImmunizationRecommendation(r) => r,
            Self::ImplementationGuide(r) => r,
            Self::Library(r) => r,
            Self::Linkage(r) => r,
            Self::List(r) => r,
            Self::Location(r) => r,
            Self::Measure(r) => r,
            Self::MeasureReport(r) => r,
            Self::Media(r) => r,
            Self::Medication(r) => r,
            Self::MedicationAdministration(r) => r,
            Self::MedicationDispense(r) => r,
            Self::MedicationRequest(r) => r,
            Self::MedicationStatement(r) => r,
            Self::MessageDefinition(r) => r,
            Self::MessageHeader(r) => r,
            Self::NamingSystem(r) => r,
            Self::NutritionOrder(r) => r,
            Self::Observation(r) => r,
            Self::OperationDefinition(r) => r,
            Self::OperationOutcome(r) => r,
            Self::Organization(r) => r,
            Self::Parameters(r) => r,
            Self::Patient(r) => r,
            Self::PaymentNotice(r) => r,
            Self::PaymentReconciliation(r) => r,
            Self::Person(r) => r,
            Self::PlanDefinition(r) => r,
            Self::Practitioner(r) => r,
            Self::PractitionerRole(r) => r,
            Self::Procedure(r) => r,
            Self::ProcedureRequest(r) => r,
            Self::ProcessRequest(r) => r,
            Self::ProcessResponse(r) => r,
            Self::Provenance(r) => r,
            Self::Questionnaire(r) => r,
            Self::QuestionnaireResponse(r) => r,
            Self::ReferralRequest(r) => r,
            Self::RelatedPerson(r) => r,
            Self::RequestGroup(r) => r,
            Self::ResearchStudy(r) => r,
            Self::ResearchSubject(r) => r,
            Self::RiskAssessment(r) => r,
            Self::Schedule(r) => r,
            Self::SearchParameter(r) => r,
            Self::Sequence(r) => r,
            Self::ServiceDefinition(r) => r,
            Self::Slot(r) => r,
            Self::Specimen(r) => r,
            Self::StructureDefinition(r) => r,
            Self::StructureMap(r) => r,
            Self::Subscription(r) => r,
            Self::Substance(r) => r,
            Self::SupplyDelivery(r) => r,
            Self::SupplyRequest(r) => r,
            Self::Task(r) => r,
            Self::TestReport(r) => r,
            Self::TestScript(r) => r,
            Self::ValueSet(r) => r,
            Self::VisionPrescription(r) => r,
        }
    }
    /// Return the resource as mutable base resource.
    #[must_use]
    #[inline]
    pub fn as_base_resource_mut(&mut self) -> &mut dyn BaseResource {
        match self {
            Self::Account(r) => r,
            Self::ActivityDefinition(r) => r,
            Self::AdverseEvent(r) => r,
            Self::AllergyIntolerance(r) => r,
            Self::Appointment(r) => r,
            Self::AppointmentResponse(r) => r,
            Self::AuditEvent(r) => r,
            Self::Basic(r) => r,
            Self::Binary(r) => r,
            Self::BodySite(r) => r,
            Self::Bundle(r) => r,
            Self::CapabilityStatement(r) => r,
            Self::CarePlan(r) => r,
            Self::CareTeam(r) => r,
            Self::ChargeItem(r) => r,
            Self::Claim(r) => r,
            Self::ClaimResponse(r) => r,
            Self::ClinicalImpression(r) => r,
            Self::CodeSystem(r) => r,
            Self::Communication(r) => r,
            Self::CommunicationRequest(r) => r,
            Self::CompartmentDefinition(r) => r,
            Self::Composition(r) => r,
            Self::ConceptMap(r) => r,
            Self::Condition(r) => r,
            Self::Consent(r) => r,
            Self::Contract(r) => r,
            Self::Coverage(r) => r,
            Self::DataElement(r) => r,
            Self::DetectedIssue(r) => r,
            Self::Device(r) => r,
            Self::DeviceComponent(r) => r,
            Self::DeviceMetric(r) => r,
            Self::DeviceRequest(r) => r,
            Self::DeviceUseStatement(r) => r,
            Self::DiagnosticReport(r) => r,
            Self::DocumentManifest(r) => r,
            Self::DocumentReference(r) => r,
            Self::EligibilityRequest(r) => r,
            Self::EligibilityResponse(r) => r,
            Self::Encounter(r) => r,
            Self::Endpoint(r) => r,
            Self::EnrollmentRequest(r) => r,
            Self::EnrollmentResponse(r) => r,
            Self::EpisodeOfCare(r) => r,
            Self::ExpansionProfile(r) => r,
            Self::ExplanationOfBenefit(r) => r,
            Self::FamilyMemberHistory(r) => r,
            Self::Flag(r) => r,
            Self::Goal(r) => r,
            Self::GraphDefinition(r) => r,
            Self::Group(r) => r,
            Self::GuidanceResponse(r) => r,
            Self::HealthcareService(r) => r,
            Self::ImagingManifest(r) => r,
            Self::ImagingStudy(r) => r,
            Self::Immunization(r) => r,
            Self::ImmunizationRecommendation(r) => r,
            Self::ImplementationGuide(r) => r,
            Self::Library(r) => r,
            Self::Linkage(r) => r,
            Self::List(r) => r,
            Self::Location(r) => r,
            Self::Measure(r) => r,
            Self::MeasureReport(r) => r,
            Self::Media(r) => r,
            Self::Medication(r) => r,
            Self::MedicationAdministration(r) => r,
            Self::MedicationDispense(r) => r,
            Self::MedicationRequest(r) => r,
            Self::MedicationStatement(r) => r,
            Self::MessageDefinition(r) => r,
            Self::MessageHeader(r) => r,
            Self::NamingSystem(r) => r,
            Self::NutritionOrder(r) => r,
            Self::Observation(r) => r,
            Self::OperationDefinition(r) => r,
            Self::OperationOutcome(r) => r,
            Self::Organization(r) => r,
            Self::Parameters(r) => r,
            Self::Patient(r) => r,
            Self::PaymentNotice(r) => r,
            Self::PaymentReconciliation(r) => r,
            Self::Person(r) => r,
            Self::PlanDefinition(r) => r,
            Self::Practitioner(r) => r,
            Self::PractitionerRole(r) => r,
            Self::Procedure(r) => r,
            Self::ProcedureRequest(r) => r,
            Self::ProcessRequest(r) => r,
            Self::ProcessResponse(r) => r,
            Self::Provenance(r) => r,
            Self::Questionnaire(r) => r,
            Self::QuestionnaireResponse(r) => r,
            Self::ReferralRequest(r) => r,
            Self::RelatedPerson(r) => r,
            Self::RequestGroup(r) => r,
            Self::ResearchStudy(r) => r,
            Self::ResearchSubject(r) => r,
            Self::RiskAssessment(r) => r,
            Self::Schedule(r) => r,
            Self::SearchParameter(r) => r,
            Self::Sequence(r) => r,
            Self::ServiceDefinition(r) => r,
            Self::Slot(r) => r,
            Self::Specimen(r) => r,
            Self::StructureDefinition(r) => r,
            Self::StructureMap(r) => r,
            Self::Subscription(r) => r,
            Self::Substance(r) => r,
            Self::SupplyDelivery(r) => r,
            Self::SupplyRequest(r) => r,
            Self::Task(r) => r,
            Self::TestReport(r) => r,
            Self::TestScript(r) => r,
            Self::ValueSet(r) => r,
            Self::VisionPrescription(r) => r,
        }
    }
}
/** Base StructureDefinition for DomainResource Resource

 **DomainResource v3.0.2**

 A resource with narrative, extensions, and contained resources

 A resource that includes narrative, extensions, and contained resources.

 */
pub trait DomainResource {
    #[doc = concat!("Get `", stringify!(id), "`.")]
    fn id(&self) -> &Option<String>;
    #[doc = concat!("Get `", stringify!(id), "` mutably.")]
    fn id_mut(&mut self) -> &mut Option<String>;
    #[doc = concat!("Set `", stringify!(id), "`.")]
    fn set_id(&mut self, value: Option<String>);
    #[doc = concat!("Get `", stringify!(meta), "`.")]
    fn meta(&self) -> &Option<Meta>;
    #[doc = concat!("Get `", stringify!(meta), "` mutably.")]
    fn meta_mut(&mut self) -> &mut Option<Meta>;
    #[doc = concat!("Set `", stringify!(meta), "`.")]
    fn set_meta(&mut self, value: Option<Meta>);
    #[doc = concat!("Get `", stringify!(implicit_rules), "`.")]
    fn implicit_rules(&self) -> &Option<String>;
    #[doc = concat!("Get `", stringify!(implicit_rules), "` mutably.")]
    fn implicit_rules_mut(&mut self) -> &mut Option<String>;
    #[doc = concat!("Set `", stringify!(implicit_rules), "`.")]
    fn set_implicit_rules(&mut self, value: Option<String>);
    #[doc = concat!("Get `", stringify!(language), "`.")]
    fn language(&self) -> &Option<String>;
    #[doc = concat!("Get `", stringify!(language), "` mutably.")]
    fn language_mut(&mut self) -> &mut Option<String>;
    #[doc = concat!("Set `", stringify!(language), "`.")]
    fn set_language(&mut self, value: Option<String>);
    #[doc = concat!("Get `", stringify!(text), "`.")]
    fn text(&self) -> &Option<Narrative>;
    #[doc = concat!("Get `", stringify!(text), "` mutably.")]
    fn text_mut(&mut self) -> &mut Option<Narrative>;
    #[doc = concat!("Set `", stringify!(text), "`.")]
    fn set_text(&mut self, value: Option<Narrative>);
    #[doc = concat!("Get `", stringify!(contained), "`.")]
    fn contained(&self) -> &Vec<Resource>;
    #[doc = concat!("Get `", stringify!(contained), "` mutably.")]
    fn contained_mut(&mut self) -> &mut Vec<Resource>;
    #[doc = concat!("Set `", stringify!(contained), "`.")]
    fn set_contained(&mut self, value: Vec<Resource>);
    #[doc = concat!("Get `", stringify!(extension), "`.")]
    fn extension(&self) -> &Vec<Extension>;
    #[doc = concat!("Get `", stringify!(extension), "` mutably.")]
    fn extension_mut(&mut self) -> &mut Vec<Extension>;
    #[doc = concat!("Set `", stringify!(extension), "`.")]
    fn set_extension(&mut self, value: Vec<Extension>);
    #[doc = concat!("Get `", stringify!(modifier_extension), "`.")]
    fn modifier_extension(&self) -> &Vec<Extension>;
    #[doc = concat!("Get `", stringify!(modifier_extension), "` mutably.")]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension>;
    #[doc = concat!("Set `", stringify!(modifier_extension), "`.")]
    fn set_modifier_extension(&mut self, value: Vec<Extension>);
}
impl DomainResource for Account {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for ActivityDefinition {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for AdverseEvent {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for AllergyIntolerance {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Appointment {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for AppointmentResponse {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for AuditEvent {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Basic {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for BodySite {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for CapabilityStatement {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for CarePlan {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for CareTeam {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for ChargeItem {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Claim {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for ClaimResponse {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for ClinicalImpression {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for CodeSystem {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Communication {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for CommunicationRequest {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for CompartmentDefinition {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Composition {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for ConceptMap {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Condition {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Consent {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Contract {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Coverage {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for DataElement {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for DetectedIssue {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Device {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for DeviceComponent {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for DeviceMetric {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for DeviceRequest {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for DeviceUseStatement {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for DiagnosticReport {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for DocumentManifest {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for DocumentReference {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for EligibilityRequest {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for EligibilityResponse {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Encounter {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Endpoint {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for EnrollmentRequest {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for EnrollmentResponse {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for EpisodeOfCare {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for ExpansionProfile {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for ExplanationOfBenefit {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for FamilyMemberHistory {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Flag {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Goal {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for GraphDefinition {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Group {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for GuidanceResponse {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for HealthcareService {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for ImagingManifest {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for ImagingStudy {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Immunization {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for ImmunizationRecommendation {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for ImplementationGuide {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Library {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Linkage {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for List {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Location {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Measure {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for MeasureReport {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Media {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Medication {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for MedicationAdministration {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for MedicationDispense {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for MedicationRequest {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for MedicationStatement {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for MessageDefinition {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for MessageHeader {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for NamingSystem {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for NutritionOrder {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Observation {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for OperationDefinition {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for OperationOutcome {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Organization {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Patient {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for PaymentNotice {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for PaymentReconciliation {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Person {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for PlanDefinition {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Practitioner {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for PractitionerRole {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Procedure {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for ProcedureRequest {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for ProcessRequest {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for ProcessResponse {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Provenance {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Questionnaire {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for QuestionnaireResponse {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for ReferralRequest {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for RelatedPerson {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for RequestGroup {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for ResearchStudy {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for ResearchSubject {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for RiskAssessment {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Schedule {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for SearchParameter {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Sequence {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for ServiceDefinition {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Slot {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Specimen {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for StructureDefinition {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for StructureMap {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Subscription {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Substance {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for SupplyDelivery {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for SupplyRequest {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for Task {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for TestReport {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for TestScript {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for ValueSet {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl DomainResource for VisionPrescription {
    #[inline]
    fn id(&self) -> &Option<String> {
        &self.id
    }
    #[inline]
    fn id_mut(&mut self) -> &mut Option<String> {
        &mut self.id
    }
    #[inline]
    fn set_id(&mut self, value: Option<String>) {
        self.id = value;
    }
    #[inline]
    fn meta(&self) -> &Option<Meta> {
        &self.meta
    }
    #[inline]
    fn meta_mut(&mut self) -> &mut Option<Meta> {
        &mut self.meta
    }
    #[inline]
    fn set_meta(&mut self, value: Option<Meta>) {
        self.meta = value;
    }
    #[inline]
    fn implicit_rules(&self) -> &Option<String> {
        &self.implicit_rules
    }
    #[inline]
    fn implicit_rules_mut(&mut self) -> &mut Option<String> {
        &mut self.implicit_rules
    }
    #[inline]
    fn set_implicit_rules(&mut self, value: Option<String>) {
        self.implicit_rules = value;
    }
    #[inline]
    fn language(&self) -> &Option<String> {
        &self.language
    }
    #[inline]
    fn language_mut(&mut self) -> &mut Option<String> {
        &mut self.language
    }
    #[inline]
    fn set_language(&mut self, value: Option<String>) {
        self.language = value;
    }
    #[inline]
    fn text(&self) -> &Option<Narrative> {
        &self.text
    }
    #[inline]
    fn text_mut(&mut self) -> &mut Option<Narrative> {
        &mut self.text
    }
    #[inline]
    fn set_text(&mut self, value: Option<Narrative>) {
        self.text = value;
    }
    #[inline]
    fn contained(&self) -> &Vec<Resource> {
        &self.contained
    }
    #[inline]
    fn contained_mut(&mut self) -> &mut Vec<Resource> {
        &mut self.contained
    }
    #[inline]
    fn set_contained(&mut self, value: Vec<Resource>) {
        self.contained = value;
    }
    #[inline]
    fn extension(&self) -> &Vec<Extension> {
        &self.extension
    }
    #[inline]
    fn extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.extension
    }
    #[inline]
    fn set_extension(&mut self, value: Vec<Extension>) {
        self.extension = value;
    }
    #[inline]
    fn modifier_extension(&self) -> &Vec<Extension> {
        &self.modifier_extension
    }
    #[inline]
    fn modifier_extension_mut(&mut self) -> &mut Vec<Extension> {
        &mut self.modifier_extension
    }
    #[inline]
    fn set_modifier_extension(&mut self, value: Vec<Extension>) {
        self.modifier_extension = value;
    }
}
impl Resource {
    /// Return the resource as domain resource.
    #[must_use]
    #[inline]
    pub fn as_domain_resource(&self) -> Option<&dyn DomainResource> {
        match self {
            Self::Account(r) => Some(r),
            Self::ActivityDefinition(r) => Some(r),
            Self::AdverseEvent(r) => Some(r),
            Self::AllergyIntolerance(r) => Some(r),
            Self::Appointment(r) => Some(r),
            Self::AppointmentResponse(r) => Some(r),
            Self::AuditEvent(r) => Some(r),
            Self::Basic(r) => Some(r),
            Self::BodySite(r) => Some(r),
            Self::CapabilityStatement(r) => Some(r),
            Self::CarePlan(r) => Some(r),
            Self::CareTeam(r) => Some(r),
            Self::ChargeItem(r) => Some(r),
            Self::Claim(r) => Some(r),
            Self::ClaimResponse(r) => Some(r),
            Self::ClinicalImpression(r) => Some(r),
            Self::CodeSystem(r) => Some(r),
            Self::Communication(r) => Some(r),
            Self::CommunicationRequest(r) => Some(r),
            Self::CompartmentDefinition(r) => Some(r),
            Self::Composition(r) => Some(r),
            Self::ConceptMap(r) => Some(r),
            Self::Condition(r) => Some(r),
            Self::Consent(r) => Some(r),
            Self::Contract(r) => Some(r),
            Self::Coverage(r) => Some(r),
            Self::DataElement(r) => Some(r),
            Self::DetectedIssue(r) => Some(r),
            Self::Device(r) => Some(r),
            Self::DeviceComponent(r) => Some(r),
            Self::DeviceMetric(r) => Some(r),
            Self::DeviceRequest(r) => Some(r),
            Self::DeviceUseStatement(r) => Some(r),
            Self::DiagnosticReport(r) => Some(r),
            Self::DocumentManifest(r) => Some(r),
            Self::DocumentReference(r) => Some(r),
            Self::EligibilityRequest(r) => Some(r),
            Self::EligibilityResponse(r) => Some(r),
            Self::Encounter(r) => Some(r),
            Self::Endpoint(r) => Some(r),
            Self::EnrollmentRequest(r) => Some(r),
            Self::EnrollmentResponse(r) => Some(r),
            Self::EpisodeOfCare(r) => Some(r),
            Self::ExpansionProfile(r) => Some(r),
            Self::ExplanationOfBenefit(r) => Some(r),
            Self::FamilyMemberHistory(r) => Some(r),
            Self::Flag(r) => Some(r),
            Self::Goal(r) => Some(r),
            Self::GraphDefinition(r) => Some(r),
            Self::Group(r) => Some(r),
            Self::GuidanceResponse(r) => Some(r),
            Self::HealthcareService(r) => Some(r),
            Self::ImagingManifest(r) => Some(r),
            Self::ImagingStudy(r) => Some(r),
            Self::Immunization(r) => Some(r),
            Self::ImmunizationRecommendation(r) => Some(r),
            Self::ImplementationGuide(r) => Some(r),
            Self::Library(r) => Some(r),
            Self::Linkage(r) => Some(r),
            Self::List(r) => Some(r),
            Self::Location(r) => Some(r),
            Self::Measure(r) => Some(r),
            Self::MeasureReport(r) => Some(r),
            Self::Media(r) => Some(r),
            Self::Medication(r) => Some(r),
            Self::MedicationAdministration(r) => Some(r),
            Self::MedicationDispense(r) => Some(r),
            Self::MedicationRequest(r) => Some(r),
            Self::MedicationStatement(r) => Some(r),
            Self::MessageDefinition(r) => Some(r),
            Self::MessageHeader(r) => Some(r),
            Self::NamingSystem(r) => Some(r),
            Self::NutritionOrder(r) => Some(r),
            Self::Observation(r) => Some(r),
            Self::OperationDefinition(r) => Some(r),
            Self::OperationOutcome(r) => Some(r),
            Self::Organization(r) => Some(r),
            Self::Patient(r) => Some(r),
            Self::PaymentNotice(r) => Some(r),
            Self::PaymentReconciliation(r) => Some(r),
            Self::Person(r) => Some(r),
            Self::PlanDefinition(r) => Some(r),
            Self::Practitioner(r) => Some(r),
            Self::PractitionerRole(r) => Some(r),
            Self::Procedure(r) => Some(r),
            Self::ProcedureRequest(r) => Some(r),
            Self::ProcessRequest(r) => Some(r),
            Self::ProcessResponse(r) => Some(r),
            Self::Provenance(r) => Some(r),
            Self::Questionnaire(r) => Some(r),
            Self::QuestionnaireResponse(r) => Some(r),
            Self::ReferralRequest(r) => Some(r),
            Self::RelatedPerson(r) => Some(r),
            Self::RequestGroup(r) => Some(r),
            Self::ResearchStudy(r) => Some(r),
            Self::ResearchSubject(r) => Some(r),
            Self::RiskAssessment(r) => Some(r),
            Self::Schedule(r) => Some(r),
            Self::SearchParameter(r) => Some(r),
            Self::Sequence(r) => Some(r),
            Self::ServiceDefinition(r) => Some(r),
            Self::Slot(r) => Some(r),
            Self::Specimen(r) => Some(r),
            Self::StructureDefinition(r) => Some(r),
            Self::StructureMap(r) => Some(r),
            Self::Subscription(r) => Some(r),
            Self::Substance(r) => Some(r),
            Self::SupplyDelivery(r) => Some(r),
            Self::SupplyRequest(r) => Some(r),
            Self::Task(r) => Some(r),
            Self::TestReport(r) => Some(r),
            Self::TestScript(r) => Some(r),
            Self::ValueSet(r) => Some(r),
            Self::VisionPrescription(r) => Some(r),
            _ => None,
        }
    }
    /// Return the resource as mutable domain resource.
    #[must_use]
    #[inline]
    pub fn as_domain_resource_mut(&mut self) -> Option<&mut dyn DomainResource> {
        match self {
            Self::Account(r) => Some(r),
            Self::ActivityDefinition(r) => Some(r),
            Self::AdverseEvent(r) => Some(r),
            Self::AllergyIntolerance(r) => Some(r),
            Self::Appointment(r) => Some(r),
            Self::AppointmentResponse(r) => Some(r),
            Self::AuditEvent(r) => Some(r),
            Self::Basic(r) => Some(r),
            Self::BodySite(r) => Some(r),
            Self::CapabilityStatement(r) => Some(r),
            Self::CarePlan(r) => Some(r),
            Self::CareTeam(r) => Some(r),
            Self::ChargeItem(r) => Some(r),
            Self::Claim(r) => Some(r),
            Self::ClaimResponse(r) => Some(r),
            Self::ClinicalImpression(r) => Some(r),
            Self::CodeSystem(r) => Some(r),
            Self::Communication(r) => Some(r),
            Self::CommunicationRequest(r) => Some(r),
            Self::CompartmentDefinition(r) => Some(r),
            Self::Composition(r) => Some(r),
            Self::ConceptMap(r) => Some(r),
            Self::Condition(r) => Some(r),
            Self::Consent(r) => Some(r),
            Self::Contract(r) => Some(r),
            Self::Coverage(r) => Some(r),
            Self::DataElement(r) => Some(r),
            Self::DetectedIssue(r) => Some(r),
            Self::Device(r) => Some(r),
            Self::DeviceComponent(r) => Some(r),
            Self::DeviceMetric(r) => Some(r),
            Self::DeviceRequest(r) => Some(r),
            Self::DeviceUseStatement(r) => Some(r),
            Self::DiagnosticReport(r) => Some(r),
            Self::DocumentManifest(r) => Some(r),
            Self::DocumentReference(r) => Some(r),
            Self::EligibilityRequest(r) => Some(r),
            Self::EligibilityResponse(r) => Some(r),
            Self::Encounter(r) => Some(r),
            Self::Endpoint(r) => Some(r),
            Self::EnrollmentRequest(r) => Some(r),
            Self::EnrollmentResponse(r) => Some(r),
            Self::EpisodeOfCare(r) => Some(r),
            Self::ExpansionProfile(r) => Some(r),
            Self::ExplanationOfBenefit(r) => Some(r),
            Self::FamilyMemberHistory(r) => Some(r),
            Self::Flag(r) => Some(r),
            Self::Goal(r) => Some(r),
            Self::GraphDefinition(r) => Some(r),
            Self::Group(r) => Some(r),
            Self::GuidanceResponse(r) => Some(r),
            Self::HealthcareService(r) => Some(r),
            Self::ImagingManifest(r) => Some(r),
            Self::ImagingStudy(r) => Some(r),
            Self::Immunization(r) => Some(r),
            Self::ImmunizationRecommendation(r) => Some(r),
            Self::ImplementationGuide(r) => Some(r),
            Self::Library(r) => Some(r),
            Self::Linkage(r) => Some(r),
            Self::List(r) => Some(r),
            Self::Location(r) => Some(r),
            Self::Measure(r) => Some(r),
            Self::MeasureReport(r) => Some(r),
            Self::Media(r) => Some(r),
            Self::Medication(r) => Some(r),
            Self::MedicationAdministration(r) => Some(r),
            Self::MedicationDispense(r) => Some(r),
            Self::MedicationRequest(r) => Some(r),
            Self::MedicationStatement(r) => Some(r),
            Self::MessageDefinition(r) => Some(r),
            Self::MessageHeader(r) => Some(r),
            Self::NamingSystem(r) => Some(r),
            Self::NutritionOrder(r) => Some(r),
            Self::Observation(r) => Some(r),
            Self::OperationDefinition(r) => Some(r),
            Self::OperationOutcome(r) => Some(r),
            Self::Organization(r) => Some(r),
            Self::Patient(r) => Some(r),
            Self::PaymentNotice(r) => Some(r),
            Self::PaymentReconciliation(r) => Some(r),
            Self::Person(r) => Some(r),
            Self::PlanDefinition(r) => Some(r),
            Self::Practitioner(r) => Some(r),
            Self::PractitionerRole(r) => Some(r),
            Self::Procedure(r) => Some(r),
            Self::ProcedureRequest(r) => Some(r),
            Self::ProcessRequest(r) => Some(r),
            Self::ProcessResponse(r) => Some(r),
            Self::Provenance(r) => Some(r),
            Self::Questionnaire(r) => Some(r),
            Self::QuestionnaireResponse(r) => Some(r),
            Self::ReferralRequest(r) => Some(r),
            Self::RelatedPerson(r) => Some(r),
            Self::RequestGroup(r) => Some(r),
            Self::ResearchStudy(r) => Some(r),
            Self::ResearchSubject(r) => Some(r),
            Self::RiskAssessment(r) => Some(r),
            Self::Schedule(r) => Some(r),
            Self::SearchParameter(r) => Some(r),
            Self::Sequence(r) => Some(r),
            Self::ServiceDefinition(r) => Some(r),
            Self::Slot(r) => Some(r),
            Self::Specimen(r) => Some(r),
            Self::StructureDefinition(r) => Some(r),
            Self::StructureMap(r) => Some(r),
            Self::Subscription(r) => Some(r),
            Self::Substance(r) => Some(r),
            Self::SupplyDelivery(r) => Some(r),
            Self::SupplyRequest(r) => Some(r),
            Self::Task(r) => Some(r),
            Self::TestReport(r) => Some(r),
            Self::TestScript(r) => Some(r),
            Self::ValueSet(r) => Some(r),
            Self::VisionPrescription(r) => Some(r),
            _ => None,
        }
    }
}
/// Simple trait to supply (const) information about resources.
pub trait NamedResource {
    /// The FHIR version of this resource.
    const FHIR_VERSION: &'static str;
    /// The ResourceType of this resouce.
    const TYPE: ResourceType;
}
impl NamedResource for Account {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Account;
}
impl NamedResource for ActivityDefinition {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::ActivityDefinition;
}
impl NamedResource for AdverseEvent {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::AdverseEvent;
}
impl NamedResource for AllergyIntolerance {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::AllergyIntolerance;
}
impl NamedResource for Appointment {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Appointment;
}
impl NamedResource for AppointmentResponse {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::AppointmentResponse;
}
impl NamedResource for AuditEvent {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::AuditEvent;
}
impl NamedResource for Basic {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Basic;
}
impl NamedResource for Binary {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Binary;
}
impl NamedResource for BodySite {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::BodySite;
}
impl NamedResource for Bundle {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Bundle;
}
impl NamedResource for CapabilityStatement {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::CapabilityStatement;
}
impl NamedResource for CarePlan {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::CarePlan;
}
impl NamedResource for CareTeam {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::CareTeam;
}
impl NamedResource for ChargeItem {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::ChargeItem;
}
impl NamedResource for Claim {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Claim;
}
impl NamedResource for ClaimResponse {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::ClaimResponse;
}
impl NamedResource for ClinicalImpression {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::ClinicalImpression;
}
impl NamedResource for CodeSystem {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::CodeSystem;
}
impl NamedResource for Communication {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Communication;
}
impl NamedResource for CommunicationRequest {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::CommunicationRequest;
}
impl NamedResource for CompartmentDefinition {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::CompartmentDefinition;
}
impl NamedResource for Composition {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Composition;
}
impl NamedResource for ConceptMap {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::ConceptMap;
}
impl NamedResource for Condition {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Condition;
}
impl NamedResource for Consent {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Consent;
}
impl NamedResource for Contract {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Contract;
}
impl NamedResource for Coverage {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Coverage;
}
impl NamedResource for DataElement {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::DataElement;
}
impl NamedResource for DetectedIssue {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::DetectedIssue;
}
impl NamedResource for Device {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Device;
}
impl NamedResource for DeviceComponent {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::DeviceComponent;
}
impl NamedResource for DeviceMetric {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::DeviceMetric;
}
impl NamedResource for DeviceRequest {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::DeviceRequest;
}
impl NamedResource for DeviceUseStatement {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::DeviceUseStatement;
}
impl NamedResource for DiagnosticReport {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::DiagnosticReport;
}
impl NamedResource for DocumentManifest {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::DocumentManifest;
}
impl NamedResource for DocumentReference {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::DocumentReference;
}
impl NamedResource for EligibilityRequest {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::EligibilityRequest;
}
impl NamedResource for EligibilityResponse {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::EligibilityResponse;
}
impl NamedResource for Encounter {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Encounter;
}
impl NamedResource for Endpoint {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Endpoint;
}
impl NamedResource for EnrollmentRequest {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::EnrollmentRequest;
}
impl NamedResource for EnrollmentResponse {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::EnrollmentResponse;
}
impl NamedResource for EpisodeOfCare {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::EpisodeOfCare;
}
impl NamedResource for ExpansionProfile {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::ExpansionProfile;
}
impl NamedResource for ExplanationOfBenefit {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::ExplanationOfBenefit;
}
impl NamedResource for FamilyMemberHistory {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::FamilyMemberHistory;
}
impl NamedResource for Flag {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Flag;
}
impl NamedResource for Goal {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Goal;
}
impl NamedResource for GraphDefinition {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::GraphDefinition;
}
impl NamedResource for Group {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Group;
}
impl NamedResource for GuidanceResponse {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::GuidanceResponse;
}
impl NamedResource for HealthcareService {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::HealthcareService;
}
impl NamedResource for ImagingManifest {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::ImagingManifest;
}
impl NamedResource for ImagingStudy {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::ImagingStudy;
}
impl NamedResource for Immunization {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Immunization;
}
impl NamedResource for ImmunizationRecommendation {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::ImmunizationRecommendation;
}
impl NamedResource for ImplementationGuide {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::ImplementationGuide;
}
impl NamedResource for Library {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Library;
}
impl NamedResource for Linkage {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Linkage;
}
impl NamedResource for List {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::List;
}
impl NamedResource for Location {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Location;
}
impl NamedResource for Measure {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Measure;
}
impl NamedResource for MeasureReport {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::MeasureReport;
}
impl NamedResource for Media {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Media;
}
impl NamedResource for Medication {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Medication;
}
impl NamedResource for MedicationAdministration {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::MedicationAdministration;
}
impl NamedResource for MedicationDispense {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::MedicationDispense;
}
impl NamedResource for MedicationRequest {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::MedicationRequest;
}
impl NamedResource for MedicationStatement {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::MedicationStatement;
}
impl NamedResource for MessageDefinition {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::MessageDefinition;
}
impl NamedResource for MessageHeader {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::MessageHeader;
}
impl NamedResource for NamingSystem {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::NamingSystem;
}
impl NamedResource for NutritionOrder {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::NutritionOrder;
}
impl NamedResource for Observation {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Observation;
}
impl NamedResource for OperationDefinition {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::OperationDefinition;
}
impl NamedResource for OperationOutcome {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::OperationOutcome;
}
impl NamedResource for Organization {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Organization;
}
impl NamedResource for Parameters {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Parameters;
}
impl NamedResource for Patient {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Patient;
}
impl NamedResource for PaymentNotice {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::PaymentNotice;
}
impl NamedResource for PaymentReconciliation {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::PaymentReconciliation;
}
impl NamedResource for Person {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Person;
}
impl NamedResource for PlanDefinition {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::PlanDefinition;
}
impl NamedResource for Practitioner {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Practitioner;
}
impl NamedResource for PractitionerRole {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::PractitionerRole;
}
impl NamedResource for Procedure {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Procedure;
}
impl NamedResource for ProcedureRequest {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::ProcedureRequest;
}
impl NamedResource for ProcessRequest {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::ProcessRequest;
}
impl NamedResource for ProcessResponse {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::ProcessResponse;
}
impl NamedResource for Provenance {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Provenance;
}
impl NamedResource for Questionnaire {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Questionnaire;
}
impl NamedResource for QuestionnaireResponse {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::QuestionnaireResponse;
}
impl NamedResource for ReferralRequest {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::ReferralRequest;
}
impl NamedResource for RelatedPerson {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::RelatedPerson;
}
impl NamedResource for RequestGroup {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::RequestGroup;
}
impl NamedResource for ResearchStudy {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::ResearchStudy;
}
impl NamedResource for ResearchSubject {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::ResearchSubject;
}
impl NamedResource for RiskAssessment {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::RiskAssessment;
}
impl NamedResource for Schedule {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Schedule;
}
impl NamedResource for SearchParameter {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::SearchParameter;
}
impl NamedResource for Sequence {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Sequence;
}
impl NamedResource for ServiceDefinition {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::ServiceDefinition;
}
impl NamedResource for Slot {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Slot;
}
impl NamedResource for Specimen {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Specimen;
}
impl NamedResource for StructureDefinition {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::StructureDefinition;
}
impl NamedResource for StructureMap {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::StructureMap;
}
impl NamedResource for Subscription {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Subscription;
}
impl NamedResource for Substance {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Substance;
}
impl NamedResource for SupplyDelivery {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::SupplyDelivery;
}
impl NamedResource for SupplyRequest {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::SupplyRequest;
}
impl NamedResource for Task {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::Task;
}
impl NamedResource for TestReport {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::TestReport;
}
impl NamedResource for TestScript {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::TestScript;
}
impl NamedResource for ValueSet {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::ValueSet;
}
impl NamedResource for VisionPrescription {
    const FHIR_VERSION: &'static str = "3.0.2";
    const TYPE: ResourceType = ResourceType::VisionPrescription;
}
